witness: lock order reversal: 1st 0xfffffd8063d9eb48 inode (&ip->i_lock) 2nd 0xfffffd806e6a1250 fdlock (&newfdp->fd_fd.fd_lock) lock order "&newfdp->fd_fd.fd_lock"(rwlock) -> "&ip->i_lock"(rrwlock) first seen at: #0 witness_checkorder+0x6a7 sys/kern/subr_witness.c:879 #1 rw_enter+0xd1 sys/kern/kern_rwlock.c:247 #2 rrw_enter+0x4f sys/kern/kern_rwlock.c:435 #3 VOP_LOCK+0x4b sys/kern/vfs_vops.c:602 #4 vn_closefile+0x119 vn_lock sys/kern/vfs_vnops.c:561 [inline] #4 vn_closefile+0x119 vn_close sys/kern/vfs_vnops.c:288 [inline] #4 vn_closefile+0x119 sys/kern/vfs_vnops.c:587 #5 fdrop+0xc9 sys/kern/kern_descrip.c:1273 #6 closef+0x11d sys/kern/kern_descrip.c:1257 #7 finishdup+0x2b6 sys/kern/kern_descrip.c:686 #8 dodup3+0x5c5 sys/kern/kern_descrip.c:377 #9 syscall+0x552 mi_syscall sys/sys/syscall_mi.h:92 [inline] #9 syscall+0x552 sys/arch/amd64/amd64/trap.c:555 #10 Xsyscall+0x128 lock order "&ip->i_lock"(rrwlock) -> "&newfdp->fd_fd.fd_lock"(rwlock) first seen at: #0 witness_checkorder+0x6a7 sys/kern/subr_witness.c:879 #1 rw_enter_write+0x5b sys/kern/kern_rwlock.c:125 #2 diskmapioctl+0x237 sys/dev/diskmap.c:106 #3 VOP_IOCTL+0x88 sys/kern/vfs_vops.c:290 #4 vn_ioctl+0xb7 sys/kern/vfs_vnops.c:524 #5 sys_ioctl+0x5b8 #6 syscall+0x552 mi_syscall sys/sys/syscall_mi.h:92 [inline] #6 syscall+0x552 sys/arch/amd64/amd64/trap.c:555 #7 Xsyscall+0x128 Stopped at db_enter+0x18: addq $0x8,%rsp ddb{0}> ddb{0}> set $lines = 0 ddb{0}> set $maxwidth = 0 ddb{0}> show panic the kernel did not panic ddb{0}> trace db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398 witness_checkorder(fffffd806e6a1250,9,0) at witness_checkorder+0xffc witness_debugger sys/kern/subr_witness.c:2506 [inline] witness_checkorder(fffffd806e6a1250,9,0) at witness_checkorder+0xffc sys/kern/subr_witness.c:1086 rw_enter_write(fffffd806e6a1240) at rw_enter_write+0x5b sys/kern/kern_rwlock.c:125 diskmapioctl(5a00,c0106477,ffff800022bbf220,1,ffff800020ab0a30) at diskmapioctl+0x237 sys/dev/diskmap.c:106 VOP_IOCTL(fffffd806fa714b8,c0106477,ffff800022bbf220,1,fffffd807f7c6900,ffff800020ab0a30) at VOP_IOCTL+0x88 sys/kern/vfs_vops.c:290 vn_ioctl(fffffd807dde3ef0,c0106477,ffff800022bbf220,ffff800020ab0a30) at vn_ioctl+0xb7 sys/kern/vfs_vnops.c:524 sys_ioctl(ffff800020ab0a30,ffff800022bbf338,ffff800022bbf3a0) at sys_ioctl+0x5b8 syscall(ffff800022bbf410) at syscall+0x552 mi_syscall sys/sys/syscall_mi.h:92 [inline] syscall(ffff800022bbf410) at syscall+0x552 sys/arch/amd64/amd64/trap.c:555 Xsyscall(0,0,ffffffffffffff1b,0,3,686721350e0) at Xsyscall+0x128 end of kernel end trace frame: 0x6896362ce80, count: -9 ddb{0}> show registers rdi 0x3 rsi 0x3ffff acpi_pdirpa+0x2be67 rbp 0xffff800022bbede0 rbx 0x3 rdx 0x40000 acpi_pdirpa+0x2be68 rcx 0xffff800021140000 rax 0xffff800000a45c40 r8 0xffffffff81c43405 witness_checkorder+0xfd5 r9 0x5 r10 0x3 r11 0xd931cd37c90bb612 r12 0xfffffd80029b9c00 r13 0 r14 0xffffffff825c67d0 w_lodata+0x379a0 r15 0xffffffff825e3260 w_lodata+0x54430 rip 0xffffffff8195cff8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800022bbedd0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.0) pid=188954 stat=onproc flags process=0 proc=4000000 pri=32, usrpri=80, nice=20 forw=0xffffffffffffffff, list=0xffff800020ab0f20,0xffff800020abea08 process=0xffff800020adc700 user=0xffff800022bba000, vmspace=0xfffffd807f00cb80 estcpu=30, cpticks=0, pctcpu=0.1 user=0, sys=0, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 15039 442576 70796 0 2 0 syz-executor.0 15039 442337 70796 0 7 0x4000000 syz-executor.0 *15039 188954 70796 0 7 0x4000000 syz-executor.0 15039 356119 70796 0 2 0x4000000 syz-executor.0 15039 111958 70796 0 2 0x4000000 syz-executor.0 86971 471902 40998 0 3 0x82 piperd syz-executor.1 70796 316534 40998 0 3 0x82 nanosleep syz-executor.0 85143 499540 0 0 3 0x14200 acct acct 15416 311375 1 0 3 0x100083 ttyin getty 27696 250157 0 0 3 0x14200 bored sosplice 40998 7736 64770 0 3 0x82 thrsleep syz-fuzzer 40998 80828 64770 0 2 0x4000002 syz-fuzzer 40998 14366 64770 0 3 0x4000082 thrsleep syz-fuzzer 40998 143452 64770 0 3 0x4000082 thrsleep syz-fuzzer 40998 515085 64770 0 3 0x4000082 thrsleep syz-fuzzer 40998 174715 64770 0 3 0x4000082 thrsleep syz-fuzzer 40998 483131 64770 0 3 0x4000082 thrsleep syz-fuzzer 40998 202856 64770 0 3 0x4000082 thrsleep syz-fuzzer 40998 269454 64770 0 3 0x4000082 kqread syz-fuzzer 40998 89912 64770 0 3 0x4000082 thrsleep syz-fuzzer 64770 238856 62010 0 3 0x10008a pause ksh 62010 115947 80486 0 3 0x92 select sshd 80486 454753 1 0 3 0x80 select sshd 86921 524028 64240 74 3 0x100092 bpf pflogd 64240 68279 1 0 3 0x80 netio pflogd 44904 368743 21052 73 3 0x100090 kqread syslogd 21052 382511 1 0 3 0x100082 netio syslogd 8810 100218 1 77 3 0x100090 poll dhclient 91512 198866 1 0 3 0x80 poll dhclient 28821 332511 0 0 3 0x14200 pgzero zerothread 99348 110265 0 0 3 0x14200 aiodoned aiodoned 81395 141467 0 0 3 0x14200 syncer update 87266 51703 0 0 3 0x14200 cleaner cleaner 27501 438413 0 0 3 0x14200 reaper reaper 6459 338280 0 0 3 0x14200 pgdaemon pagedaemon 96631 37233 0 0 3 0x14200 bored crynlk 49336 519302 0 0 3 0x14200 bored crypto 38285 241880 0 0 3 0x40014200 acpi0 acpi0 62914 103127 0 0 3 0x40014200 idle1 5659 24631 0 0 3 0x14200 bored softnet 29370 340160 0 0 3 0x14200 bored systqmp 43412 57515 0 0 3 0x14200 bored systq 65076 297693 0 0 3 0x40014200 bored softclock 21549 503389 0 0 3 0x40014200 idle0 62804 195883 0 0 3 0x14200 bored smr 1 411628 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 15039 (syz-executor.0) thread 0xffff800020ab0a30 (188954) exclusive rrwlock inode r = 0 (0xfffffd8063d9eb48) #0 witness_lock+0x52e sys/kern/subr_witness.c:1163 #1 rw_enter+0x46d sys/kern/kern_rwlock.c:306 #2 rrw_enter+0x4f sys/kern/kern_rwlock.c:435 #3 VOP_LOCK+0x4b sys/kern/vfs_vops.c:602 #4 vn_lock+0x6e sys/kern/vfs_vnops.c:561 #5 spec_open+0x431 sys/kern/spec_vnops.c:159 #6 VOP_OPEN+0x6a sys/kern/vfs_vops.c:153 #7 vn_open+0x495 sys/kern/vfs_vnops.c:174 #8 diskmapioctl+0x18e sys/dev/diskmap.c:91 #9 VOP_IOCTL+0x88 sys/kern/vfs_vops.c:290 #10 vn_ioctl+0xb7 sys/kern/vfs_vnops.c:524 #11 sys_ioctl+0x5b8 #12 syscall+0x552 mi_syscall sys/sys/syscall_mi.h:92 [inline] #12 syscall+0x552 sys/arch/amd64/amd64/trap.c:555 #13 Xsyscall+0x128 exclusive kernel_lock &kernel_lock r = 0 (0xffffffff826445e0) #0 witness_lock+0x52e sys/kern/subr_witness.c:1163 #1 __mp_acquire_count+0x51 sys/kern/kern_lock.c:227 #2 mi_switch+0x38f sys/kern/sched_bsd.c:441 #3 sleep_finish+0x113 sys/kern/kern_synch.c:373 #4 rw_enter+0x366 sys/kern/kern_rwlock.c:282 #5 rrw_enter+0x4f sys/kern/kern_rwlock.c:435 #6 VOP_LOCK+0x4b sys/kern/vfs_vops.c:602 #7 vn_lock+0x6e sys/kern/vfs_vnops.c:561 #8 spec_open+0x431 sys/kern/spec_vnops.c:159 #9 VOP_OPEN+0x6a sys/kern/vfs_vops.c:153 #10 vn_open+0x495 sys/kern/vfs_vnops.c:174 #11 diskmapioctl+0x18e sys/dev/diskmap.c:91 #12 VOP_IOCTL+0x88 sys/kern/vfs_vops.c:290 #13 vn_ioctl+0xb7 sys/kern/vfs_vnops.c:524 #14 sys_ioctl+0x5b8 #15 syscall+0x552 mi_syscall sys/sys/syscall_mi.h:92 [inline] #15 syscall+0x552 sys/arch/amd64/amd64/trap.c:555 #16 Xsyscall+0x128 ddb{0}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim Kern Lim devbuf 9668 6616K 15824K 78643K 65716 0 0 pcb 13 8K 8K 78643K 1942 0 0 rtable 113 4K 5K 78643K 6990 0 0 ifaddr 101 29K 37K 78643K 2478 0 0 counters 39 33K 33K 78643K 39 0 0 ioctlops 0 0K 4K 78643K 2572 0 0 iov 0 0K 32K 78643K 2248 0 0 mount 1 1K 1K 78643K 1 0 0 vnodes 1192 75K 77K 78643K 21089 0 0 UFS quota 1 32K 32K 78643K 1 0 0 UFS mount 5 36K 36K 78643K 5 0 0 shm 3 5K 9K 78643K 299 0 0 VM map 2 1K 1K 78643K 2 0 0 sem 12 0K 0K 78643K 3042 0 0 dirhash 12 2K 2K 78643K 12 0 0 ACPI 1808 196K 290K 78643K 12765 0 0 file desc 5 13K 25K 78643K 24293 0 0 sigio 0 0K 0K 78643K 242 0 0 proc 54 51K 83K 78643K 5350 0 0 subproc 32 2K 2K 78643K 1287 0 0 NFS srvsock 1 0K 0K 78643K 1 0 0 NFS daemon 1 16K 16K 78643K 1 0 0 ip_moptions 0 0K 0K 78643K 1873 0 0 in_multi 33 2K 2K 78643K 1435 0 0 ether_multi 1 0K 0K 78643K 87 0 0 mrt 3 0K 0K 78643K 58 0 0 ISOFS mount 1 32K 32K 78643K 1 0 0 MSDOSFS mount 1 16K 16K 78643K 1 0 0 ttys 138 609K 609K 78643K 138 0 0 exec 0 0K 1K 78643K 2876 0 0 pfkey data 0 0K 4K 78643K 7 0 0 pagedep 1 8K 8K 78643K 1 0 0 inodedep 1 32K 32K 78643K 1 0 0 newblk 1 0K 0K 78643K 1 0 0 VM swap 7 26K 26K 78643K 7 0 0 UVM amap 143 24K 34K 78643K 77520 0 0 UVM aobj 130 4K 4K 78643K 150 0 0 memdesc 1 4K 4K 78643K 1 0 0 crypto data 1 1K 1K 78643K 1 0 0 ip6_options 0 0K 1K 78643K 2535 0 0 NDP 26 0K 1K 78643K 772 0 0 temp 270 3558K 4198K 78643K 298386 0 0 kqueue 0 0K 0K 78643K 143 0 0 SYN cache 2 16K 16K 78643K 2 0 0 ddb{0}> show all pools Name Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle arp 64 156 0 150 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtpcb 80 904 0 902 1 0 1 1 0 8 0 rtentry 112 881 0 837 5 3 2 2 0 8 0 unpcb 120 6993 0 6983 1 0 1 1 0 8 0 syncache 264 4 0 4 1 1 0 1 0 8 0 sackhl 24 1 0 1 1 1 0 1 0 8 0 tcpqe 32 10278 0 10278 4 4 0 1 0 8 0 tcpcb 544 4110 0 4106 1 0 1 1 0 8 0 inpcb 280 12280 0 12271 34 33 1 2 0 8 0 rttmr 72 9 0 9 9 9 0 1 0 8 0 ip6q 72 90 0 90 4 4 0 1 0 8 0 ip6af 48 180 0 180 4 4 0 1 0 8 0 nd6 48 225 0 219 1 0 1 1 0 8 0 pkpcb 40 81 0 81 27 27 0 1 0 8 0 swfcl 56 9 0 0 1 0 1 1 0 8 0 ppxss 1128 413 0 413 62 61 1 1 0 8 1 pffrag 232 43 0 43 25 25 0 1 0 482 0 pffrnode 88 43 0 43 25 25 0 1 0 8 0 pffrent 40 105 0 105 26 26 0 1 0 8 0 pfosfp 40 846 0 846 5 5 0 5 0 8 0 pfosfpen 112 1428 0 1428 21 21 0 21 0 8 0 pfstitem 24 688 0 667 1 0 1 1 0 8 0 pfstkey 112 688 0 667 5 3 2 5 0 8 1 pfstate 328 688 0 667 16 14 2 12 0 8 0 pfrule 1360 21 0 16 2 1 1 2 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 3670 0 3472 30 17 13 14 0 8 0 art_table 32 3671 0 3472 2 0 2 2 0 8 0 art_node 16 860 0 820 1 0 1 1 0 8 0 sysvmsgpl 40 3 0 3 1 1 0 1 0 8 0 semapl 112 3040 0 3030 1 0 1 1 0 8 0 shmpl 112 148 0 20 5 1 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 38278 0 36793 51 2 49 49 0 8 0 ffsino 272 38278 0 36793 102 2 100 100 0 8 0 nchpl 144 72704 0 71068 62 0 62 62 0 8 0 uvmvnodes 72 7698 0 0 140 0 140 140 0 8 0 vnodes 200 7698 0 0 406 0 406 406 0 8 0 namei 1024 229949 0 229949 11 10 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scsiplug 64 61 0 61 36 36 0 1 0 8 0 scxspl 192 208323 0 208323 95 94 1 7 0 8 1 plimitpl 152 2085 0 2077 1 0 1 1 0 8 0 sigapl 432 24283 0 24268 4 2 2 3 0 8 0 futexpl 56 292171 0 292171 4 3 1 1 0 8 1 knotepl 112 5262 0 5243 1 0 1 1 0 8 0 kqueuepl 104 4955 0 4953 1 0 1 1 0 8 0 pipepl 112 18222 0 18203 28 27 1 2 0 8 0 fdescpl 488 24284 0 24268 3 0 3 3 0 8 0 filepl 152 139789 0 139682 35 30 5 7 0 8 0 lockfpl 104 7645 0 7645 11 10 1 1 0 8 1 lockfspl 48 2546 0 2546 11 10 1 1 0 8 1 sessionpl 112 100 0 89 1 0 1 1 0 8 0 pgrppl 48 302 0 291 1 0 1 1 0 8 0 ucredpl 96 24394 0 24381 1 0 1 1 0 8 0 zombiepl 144 24273 0 24273 8 7 1 1 0 8 1 processpl 896 24306 0 24273 5 1 4 5 0 8 0 procpl 632 72949 0 72903 11 6 5 5 0 8 0 srpgc 64 155 0 155 65 65 0 1 0 8 0 sosppl 128 300 0 300 60 59 1 1 0 8 1 sockpl 384 20477 0 20458 30 27 3 4 0 8 1 mcl64k 65536 1565 0 0 172 138 34 129 0 8 0 mcl16k 16384 34 0 0 4 2 2 3 0 8 0 mcl12k 12288 57 0 0 2 0 2 2 0 8 0 mcl9k 9216 73 0 0 4 2 2 2 0 8 0 mcl8k 8192 34 0 0 3 1 2 3 0 8 0 mcl4k 4096 39 0 0 3 0 3 3 0 8 0 mcl2k2 2112 10 0 0 1 0 1 1 0 8 0 mcl2k 2048 347 0 0 20 13 7 20 0 8 0 mtagpl 80 123 0 0 1 0 1 1 0 8 0 mbufpl 256 1700 0 0 67 2 65 67 0 8 0 bufpl 256 62794 0 55095 482 0 482 482 0 8 0 anonpl 16 2161881 0 2149538 405 346 59 83 0 124 0 amapchunkpl 152 141654 0 141516 91 84 7 13 0 158 0 amappl16 192 117364 0 116670 550 513 37 55 0 8 1 amappl15 184 5830 0 5830 10 10 0 1 0 8 0 amappl14 176 5596 0 5590 1 0 1 1 0 8 0 amappl13 168 3151 0 3151 10 10 0 1 0 8 0 amappl12 160 2809 0 2805 1 0 1 1 0 8 0 amappl11 152 3049 0 3030 1 0 1 1 0 8 0 amappl10 144 4401 0 4394 1 0 1 1 0 8 0 amappl9 136 4866 0 4863 1 0 1 1 0 8 0 amappl8 128 4405 0 4351 4 2 2 3 0 8 0 amappl7 120 4462 0 4453 1 0 1 1 0 8 0 amappl6 112 2857 0 2844 1 0 1 1 0 8 0 amappl5 104 3480 0 3465 1 0 1 1 0 8 0 amappl4 96 19511 0 19479 2 1 1 2 0 8 0 amappl3 88 10830 0 10819 1 0 1 1 0 8 0 amappl2 80 192052 0 191981 3 1 2 3 0 8 0 amappl1 72 521953 0 521509 25 15 10 20 0 8 0 amappl 80 74516 0 74468 2 0 2 2 0 84 0 dma4096 4096 1 0 1 1 1 0 1 0 8 0 dma256 256 6 0 6 1 1 0 1 0 8 0 dma64 64 259 0 259 1 1 0 1 0 8 0 dma32 32 7 0 7 1 1 0 1 0 8 0 dma16 16 17 0 17 1 1 0 1 0 8 0 aobjpl 64 149 0 20 3 0 3 3 0 8 0 uaddrrnd 24 24284 0 24268 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 24284 0 24268 1 0 1 1 0 8 0 vmmpekpl 168 199800 0 199770 2 0 2 2 0 8 0 vmmpepl 168 2930855 0 2928971 756 652 104 113 0 357 8 vmsppl 368 24283 0 24268 2 0 2 2 0 8 0 pdppl 4096 48575 0 48536 7 1 6 6 0 8 0 pvpl 32 5694776 0 5679141 859 711 148 198 0 265 5 pmappl 232 24283 0 24268 5 4 1 2 0 8 0 extentpl 40 41 0 26 1 0 1 1 0 8 0 phpool 112 912 0 189 23 0 23 23 0 8 0