`T2z͝ `T2z͝ witness: lock order reversal: 1st 0xfffffd806d97de78 inode (&ip->i_lock) 2nd 0xfffffd807992a9f0 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(fffffd807992a9f0,9,0) at witness_checkorder+0xffc witness_debugger sys/kern/subr_witness.c:2506 [inline] witness_checkorder(fffffd807992a9f0,9,0) at witness_checkorder+0xffc sys/kern/subr_witness.c:1086 rw_enter_write(fffffd807992a9e0) at rw_enter_write+0x5b sys/kern/kern_rwlock.c:125 diskmapioctl(5a00,c0106477,ffff800022d69bb0,1,ffff800020abe508) at diskmapioctl+0x237 sys/dev/diskmap.c:106 VOP_IOCTL(fffffd806fa813f0,c0106477,ffff800022d69bb0,1,fffffd807f7c6ae0,ffff800020abe508) at VOP_IOCTL+0x88 sys/kern/vfs_vops.c:290 vn_ioctl(fffffd80672c3720,c0106477,ffff800022d69bb0,ffff800020abe508) at vn_ioctl+0xb7 sys/kern/vfs_vnops.c:524 sys_ioctl(ffff800020abe508,ffff800022d69cc8,ffff800022d69d30) at sys_ioctl+0x5b8 syscall(ffff800022d69da0) at syscall+0x552 mi_syscall sys/sys/syscall_mi.h:92 [inline] syscall(ffff800022d69da0) at syscall+0x552 sys/arch/amd64/amd64/trap.c:555 Xsyscall(6,0,ffffffffffffff1b,0,3,c3c2b076010) at Xsyscall+0x128 end of kernel end trace frame: 0xc3e7ca47ee0, count: -9 ddb{0}> show registers rdi 0x3 rsi 0x3ffff acpi_pdirpa+0x2be67 rbp 0xffff800022d69770 rbx 0x3 rdx 0x40000 acpi_pdirpa+0x2be68 rcx 0xffff800021d5c000 rax 0xffff800000a8c580 r8 0xffffffff81351515 witness_checkorder+0xfd5 r9 0x5 r10 0x3 r11 0x7ef6fa6b6e851042 r12 0xfffffd80029b2c00 r13 0 r14 0xffffffff825afe30 w_lodata+0x47ac0 r15 0xffffffff825bc7a0 w_lodata+0x54430 rip 0xffffffff813aceb8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800022d69760 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.0) pid=494716 stat=onproc flags process=0 proc=4000000 pri=32, usrpri=81, nice=20 forw=0xffffffffffffffff, list=0xffff800020abf3d8,0xffff800020abe2a0 process=0xffff800020adc000 user=0xffff800022d64000, vmspace=0xfffffd807f00c2e0 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 10016 302622 85910 0 3 0x80 nanosleep syz-executor.1 10016 16625 85910 0 3 0x4000080 fsleep syz-executor.1 10016 444126 85910 0 3 0x4000080 fsleep syz-executor.1 4474 78724 78279 0 2 0 syz-executor.0 * 4474 494716 78279 0 7 0x4000000 syz-executor.0 4474 291672 78279 0 2 0x4000000 syz-executor.0 4474 453098 78279 0 7 0x4000000 syz-executor.0 85910 89143 51059 0 3 0x82 nanosleep syz-executor.1 82739 354553 1 0 3 0x100083 ttyin getty 78279 463865 51059 0 3 0x82 nanosleep syz-executor.0 50076 106234 0 0 3 0x14200 bored sosplice 51059 320821 63067 0 3 0x82 thrsleep syz-fuzzer 51059 157271 63067 0 3 0x4000082 thrsleep syz-fuzzer 51059 475944 63067 0 3 0x4000082 thrsleep syz-fuzzer 51059 357183 63067 0 3 0x4000082 thrsleep syz-fuzzer 51059 451003 63067 0 3 0x4000082 kqread syz-fuzzer 51059 469780 63067 0 3 0x4000082 thrsleep syz-fuzzer 51059 277015 63067 0 3 0x4000082 thrsleep syz-fuzzer 51059 133297 63067 0 3 0x4000082 thrsleep syz-fuzzer 51059 424569 63067 0 3 0x4000082 thrsleep syz-fuzzer 51059 477290 63067 0 3 0x4000082 thrsleep syz-fuzzer 63067 200102 93320 0 3 0x10008a pause ksh 93320 231464 42992 0 3 0x92 select sshd 42992 373016 1 0 3 0x80 select sshd 26650 387495 14904 74 3 0x100092 bpf pflogd 14904 322247 1 0 3 0x80 netio pflogd 68593 7162 94173 73 3 0x100090 kqread syslogd 94173 429157 1 0 3 0x100082 netio syslogd 76724 264443 1 77 3 0x100090 poll dhclient 24501 165113 1 0 3 0x80 poll dhclient 98901 412377 0 0 3 0x14200 pgzero zerothread 52434 464780 0 0 3 0x14200 aiodoned aiodoned 59477 293348 0 0 3 0x14200 syncer update 64129 157315 0 0 3 0x14200 cleaner cleaner 80902 133526 0 0 3 0x14200 reaper reaper 33185 418816 0 0 3 0x14200 pgdaemon pagedaemon 76357 48611 0 0 3 0x14200 bored crynlk 28871 186156 0 0 3 0x14200 bored crypto 88059 97550 0 0 3 0x40014200 acpi0 acpi0 42092 107456 0 0 3 0x40014200 idle1 78331 120099 0 0 3 0x14200 bored softnet 11826 457666 0 0 3 0x14200 bored systqmp 72212 204002 0 0 3 0x14200 bored systq 73845 405744 0 0 3 0x40014200 bored softclock 66166 322924 0 0 3 0x40014200 idle0 47850 386982 0 0 3 0x14200 bored smr 1 8979 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 4474 (syz-executor.0) thread 0xffff800020abe508 (494716) exclusive rrwlock inode r = 0 (0xfffffd806d97de78) #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 (0xffffffff8264a400) #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 9556 6437K 7082K 78643K 13056 0 0 pcb 13 8K 8K 78643K 82 0 0 rtable 108 4K 4K 78643K 462 0 0 ifaddr 71 15K 15K 78643K 150 0 0 counters 39 33K 33K 78643K 39 0 0 ioctlops 0 0K 4K 78643K 1510 0 0 iov 0 0K 16K 78643K 78 0 0 mount 1 1K 1K 78643K 1 0 0 vnodes 1207 76K 76K 78643K 2077 0 0 UFS quota 1 32K 32K 78643K 1 0 0 UFS mount 5 36K 36K 78643K 5 0 0 shm 2 1K 5K 78643K 15 0 0 VM map 2 1K 1K 78643K 2 0 0 sem 12 0K 0K 78643K 128 0 0 dirhash 12 2K 2K 78643K 12 0 0 ACPI 1808 196K 290K 78643K 12765 0 0 file desc 6 17K 25K 78643K 974 0 0 sigio 0 0K 0K 78643K 16 0 0 proc 55 51K 83K 78643K 621 0 0 subproc 32 2K 2K 78643K 85 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 83 0 0 in_multi 33 2K 2K 78643K 86 0 0 ether_multi 1 0K 0K 78643K 3 0 0 mrt 0 0K 0K 78643K 3 0 0 ISOFS mount 1 32K 32K 78643K 1 0 0 MSDOSFS mount 1 16K 16K 78643K 1 0 0 ttys 66 291K 291K 78643K 66 0 0 exec 0 0K 1K 78643K 334 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 103 21K 25K 78643K 4035 0 0 UVM aobj 55 3K 3K 78643K 65 0 0 memdesc 1 4K 4K 78643K 1 0 0 crypto data 1 1K 1K 78643K 1 0 0 ip6_options 0 0K 0K 78643K 59 0 0 NDP 16 0K 0K 78643K 44 0 0 temp 200 3544K 3610K 78643K 11812 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 12 0 6 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtpcb 80 53 0 50 1 0 1 1 0 8 0 rtentry 112 79 0 35 2 0 2 2 0 8 0 unpcb 120 294 0 284 1 0 1 1 0 8 0 syncache 264 4 0 4 1 1 0 1 0 8 0 tcpqe 32 9911 0 9911 2 2 0 2 0 8 0 tcpcb 544 162 0 158 1 0 1 1 0 8 0 inpcb 280 479 0 472 1 0 1 1 0 8 0 rttmr 72 1 0 1 1 1 0 1 0 8 0 nd6 48 15 0 9 1 0 1 1 0 8 0 pkpcb 40 4 0 4 2 1 1 1 0 8 1 ppxss 1128 12 0 12 4 3 1 1 0 8 1 pffrag 232 5 0 5 3 2 1 1 0 482 1 pffrnode 88 5 0 5 3 2 1 1 0 8 1 pffrent 40 10 0 10 3 2 1 1 0 8 1 pfosfp 40 846 0 423 5 0 5 5 0 8 0 pfosfpen 112 1428 0 714 21 0 21 21 0 8 0 pfstitem 24 43 0 26 1 0 1 1 0 8 0 pfstkey 112 43 0 26 1 0 1 1 0 8 0 pfstate 328 43 0 25 2 0 2 2 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 323 0 132 12 0 12 12 0 8 0 art_table 32 324 0 132 2 0 2 2 0 8 0 art_node 16 78 0 38 1 0 1 1 0 8 0 sysvmsgpl 40 6 0 4 1 0 1 1 0 8 0 semapl 112 126 0 116 1 0 1 1 0 8 0 shmpl 112 63 0 10 2 0 2 2 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 2823 0 1408 47 0 47 47 0 8 0 ffsino 272 2823 0 1408 96 0 96 96 0 8 0 nchpl 144 4332 0 2698 62 0 62 62 0 8 0 uvmvnodes 72 3501 0 0 64 0 64 64 0 8 0 vnodes 200 3501 0 0 185 0 185 185 0 8 0 namei 1024 13361 0 13361 2 1 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scsiplug 64 3 0 3 3 2 1 1 0 8 1 scxspl 192 11343 0 11343 10 9 1 7 0 8 1 plimitpl 152 111 0 103 1 0 1 1 0 8 0 sigapl 432 1167 0 1151 3 1 2 3 0 8 0 futexpl 56 11787 0 11785 1 0 1 1 0 8 0 knotepl 112 279 0 260 1 0 1 1 0 8 0 kqueuepl 104 229 0 227 1 0 1 1 0 8 0 pipepl 112 678 0 659 1 0 1 1 0 8 0 fdescpl 488 1168 0 1151 3 0 3 3 0 8 0 filepl 152 6574 0 6467 6 1 5 5 0 8 0 lockfpl 104 240 0 240 3 2 1 1 0 8 1 lockfspl 48 80 0 80 3 2 1 1 0 8 1 sessionpl 112 23 0 12 1 0 1 1 0 8 0 pgrppl 48 45 0 34 1 0 1 1 0 8 0 ucredpl 96 1119 0 1110 1 0 1 1 0 8 0 zombiepl 144 1151 0 1151 2 1 1 1 0 8 1 processpl 896 1184 0 1151 4 0 4 4 0 8 0 procpl 632 3102 0 3055 7 3 4 5 0 8 0 srpgc 64 7 0 7 3 3 0 1 0 8 0 sosppl 128 12 0 12 1 1 0 1 0 8 0 sockpl 384 834 0 814 4 1 3 3 0 8 1 mcl64k 65536 10 0 0 2 0 2 2 0 8 0 mcl16k 16384 3 0 0 1 0 1 1 0 8 0 mcl12k 12288 13 0 0 2 0 2 2 0 8 0 mcl9k 9216 7 0 0 1 0 1 1 0 8 0 mcl8k 8192 9 0 0 2 0 2 2 0 8 0 mcl4k 4096 12 0 0 2 0 2 2 0 8 0 mcl2k 2048 193 0 0 24 1 23 24 0 8 0 mtagpl 80 20 0 0 1 0 1 1 0 8 0 mbufpl 256 241 0 0 16 1 15 15 0 8 0 bufpl 256 7081 0 1169 370 0 370 370 0 8 0 anonpl 16 125714 0 114624 86 27 59 67 0 124 5 amapchunkpl 152 6773 0 6647 14 4 10 10 0 158 4 amappl16 192 5660 0 4982 70 27 43 46 0 8 8 amappl15 184 63 0 61 1 0 1 1 0 8 0 amappl14 176 133 0 125 1 0 1 1 0 8 0 amappl13 168 273 0 273 2 2 0 1 0 8 0 amappl12 160 21 0 20 3 2 1 1 0 8 0 amappl11 152 306 0 291 1 0 1 1 0 8 0 amappl10 144 416 0 411 1 0 1 1 0 8 0 amappl9 136 643 0 640 1 0 1 1 0 8 0 amappl8 128 183 0 162 1 0 1 1 0 8 0 amappl7 120 383 0 375 1 0 1 1 0 8 0 amappl6 112 288 0 280 1 0 1 1 0 8 0 amappl5 104 160 0 144 1 0 1 1 0 8 0 amappl4 96 1650 0 1620 2 1 1 2 0 8 0 amappl3 88 347 0 331 1 0 1 1 0 8 0 amappl2 80 8212 0 8130 3 1 2 3 0 8 0 amappl1 72 34889 0 34441 26 16 10 20 0 8 0 amappl 80 3416 0 3371 1 0 1 1 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 64 0 10 1 0 1 1 0 8 0 uaddrrnd 24 1168 0 1151 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 1168 0 1151 1 0 1 1 0 8 0 vmmpekpl 168 12689 0 12656 2 0 2 2 0 8 0 vmmpepl 168 148032 0 146115 165 62 103 110 0 357 17 vmsppl 368 1167 0 1151 2 0 2 2 0 8 0 pdppl 4096 2343 0 2302 7 1 6 6 0 8 0 pvpl 32 352435 0 338051 197 42 155 164 0 265 25 pmappl 232 1167 0 1151 3 2 1 2 0 8 0 extentpl 40 41 0 26 1 0 1 1 0 8 0 phpool 112 545 0 7 16 0 16 16 0 8 0