login: witness: lock order reversal: 1st 0xfffffd806e2206f8 inode (&ip->i_lock) 2nd 0xfffffd807593c250 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{1}> ddb{1}> set $lines = 0 ddb{1}> set $maxwidth = 0 ddb{1}> show panic the kernel did not panic ddb{1}> trace db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398 witness_checkorder(fffffd807593c250,9,0) at witness_checkorder+0xffc witness_debugger sys/kern/subr_witness.c:2506 [inline] witness_checkorder(fffffd807593c250,9,0) at witness_checkorder+0xffc sys/kern/subr_witness.c:1086 rw_enter_write(fffffd807593c240) at rw_enter_write+0x5b sys/kern/kern_rwlock.c:125 diskmapioctl(5a00,c0106477,ffff800020b3cfe0,1,ffff800020a5e280) at diskmapioctl+0x237 sys/dev/diskmap.c:106 VOP_IOCTL(fffffd806fa6e260,c0106477,ffff800020b3cfe0,1,fffffd807f7c6960,ffff800020a5e280) at VOP_IOCTL+0x88 sys/kern/vfs_vops.c:290 vn_ioctl(fffffd8063fa9260,c0106477,ffff800020b3cfe0,ffff800020a5e280) at vn_ioctl+0xb7 sys/kern/vfs_vnops.c:524 sys_ioctl(ffff800020a5e280,ffff800020b3d0f8,ffff800020b3d160) at sys_ioctl+0x5b8 syscall(ffff800020b3d1d0) at syscall+0x552 mi_syscall sys/sys/syscall_mi.h:92 [inline] syscall(ffff800020b3d1d0) at syscall+0x552 sys/arch/amd64/amd64/trap.c:555 Xsyscall(6,0,ffffffffffffff1b,0,3,7f7410f91b0) at Xsyscall+0x128 end of kernel end trace frame: 0x7f98324e070, count: -9 ddb{1}> show registers rdi 0x3 rsi 0x3ffff acpi_pdirpa+0x2be67 rbp 0xffff800020b3cba0 rbx 0x3 rdx 0x40000 acpi_pdirpa+0x2be68 rcx 0xffff800022d82000 rax 0xffff800000a85940 r8 0xffffffff815fc165 witness_checkorder+0xfd5 r9 0x5 r10 0x3 r11 0xab961eeecb14ca90 r12 0xfffffd80029b8c00 r13 0 r14 0xffffffff825b0fc0 w_lodata+0x3ec70 r15 0xffffffff825c66d0 w_lodata+0x54380 rip 0xffffffff81be0708 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800020b3cb90 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{1}> show proc PROC (syz-executor.1) pid=345079 stat=onproc flags process=0 proc=4000000 pri=32, usrpri=79, nice=20 forw=0xffffffffffffffff, list=0xffff800020abeee8,0xffff800020a5f160 process=0xffff800020adca80 user=0xffff800020b38000, vmspace=0xfffffd807f00c000 estcpu=29, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND 93631 28922 19529 0 7 0 syz-executor.1 93631 240648 19529 0 2 0x4000000 syz-executor.1 93631 4976 19529 0 2 0x4000000 syz-executor.1 *93631 345079 19529 0 7 0x4000000 syz-executor.1 93631 143850 19529 0 2 0x4000000 syz-executor.1 94437 504467 1 0 3 0x82 nanosleep getty 39019 386964 98913 0 3 0x82 piperd syz-executor.0 19529 432291 98913 0 3 0x82 nanosleep syz-executor.1 13629 500871 0 0 3 0x14200 acct acct 45794 281302 0 0 3 0x14200 bored sosplice 98913 460094 25476 0 3 0x82 thrsleep syz-fuzzer 98913 345045 25476 0 3 0x4000082 thrsleep syz-fuzzer 98913 292771 25476 0 3 0x4000082 thrsleep syz-fuzzer 98913 476172 25476 0 3 0x4000082 thrsleep syz-fuzzer 98913 216205 25476 0 3 0x4000082 thrsleep syz-fuzzer 98913 170029 25476 0 3 0x4000082 kqread syz-fuzzer 98913 284117 25476 0 3 0x4000082 thrsleep syz-fuzzer 98913 478101 25476 0 3 0x4000082 thrsleep syz-fuzzer 98913 248082 25476 0 3 0x4000082 thrsleep syz-fuzzer 98913 315077 25476 0 3 0x4000082 thrsleep syz-fuzzer 25476 397959 51604 0 3 0x10008a pause ksh 51604 402439 86370 0 3 0x92 select sshd 86370 123471 1 0 3 0x80 select sshd 17070 150202 79499 74 3 0x100092 bpf pflogd 79499 435740 1 0 3 0x80 netio pflogd 60502 37999 51273 73 3 0x100090 kqread syslogd 51273 233581 1 0 3 0x100082 netio syslogd 12241 521444 0 0 3 0x14200 pgzero zerothread 1269 58209 0 0 3 0x14200 aiodoned aiodoned 39437 335238 0 0 3 0x14200 syncer update 29045 287680 0 0 3 0x14200 cleaner cleaner 87872 443253 0 0 3 0x14200 reaper reaper 82393 349423 0 0 3 0x14200 pgdaemon pagedaemon 99723 478999 0 0 3 0x14200 bored crynlk 44626 315042 0 0 3 0x14200 bored crypto 31164 282032 0 0 3 0x40014200 acpi0 acpi0 66721 327132 0 0 3 0x40014200 idle1 45489 42760 0 0 3 0x14200 bored softnet 82551 351313 0 0 3 0x14200 bored systqmp 83550 177820 0 0 3 0x14200 bored systq 13258 1745 0 0 3 0x40014200 bored softclock 75770 437957 0 0 3 0x40014200 idle0 8818 398723 0 0 3 0x14200 bored smr 1 237287 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{1}> show all locks Process 93631 (syz-executor.1) thread 0xffff800020a5e280 (345079) exclusive rrwlock inode r = 0 (0xfffffd806e2206f8) #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 (0xffffffff82672640) #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{1}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim Kern Lim devbuf 9616 6422K 10729K 78643K 37492 0 0 pcb 13 8K 8K 78643K 1102 0 0 rtable 119 12K 13K 78643K 1662 0 0 ifaddr 90 24K 28K 78643K 1143 0 0 counters 39 33K 33K 78643K 39 0 0 ioctlops 0 0K 4K 78643K 1908 0 0 iov 0 0K 17K 78643K 946 0 0 mount 1 1K 1K 78643K 1 0 0 vnodes 1211 76K 77K 78643K 10758 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 148 0 0 VM map 2 1K 1K 78643K 2 0 0 sem 12 0K 0K 78643K 1118 0 0 dirhash 12 2K 2K 78643K 12 0 0 ACPI 1808 196K 290K 78643K 12765 0 0 file desc 5 13K 25K 78643K 10671 0 0 sigio 0 0K 0K 78643K 119 0 0 proc 55 51K 83K 78643K 2569 0 0 subproc 32 2K 2K 78643K 554 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 1142 0 0 in_multi 33 2K 2K 78643K 916 0 0 ether_multi 1 0K 0K 78643K 56 0 0 mrt 0 0K 0K 78643K 22 0 0 ISOFS mount 1 32K 32K 78643K 1 0 0 MSDOSFS mount 1 16K 16K 78643K 1 0 0 ttys 108 477K 477K 78643K 108 0 0 exec 0 0K 1K 78643K 1437 0 0 pfkey data 0 0K 4K 78643K 4 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 121 22K 32K 78643K 34943 0 0 UVM aobj 130 4K 4K 78643K 140 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 1292 0 0 NDP 22 0K 0K 78643K 349 0 0 temp 242 3557K 4196K 78643K 157468 0 0 kqueue 0 0K 0K 78643K 68 0 0 SYN cache 2 16K 16K 78643K 2 0 0 ddb{1}> show all pools Name Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle arp 64 72 0 65 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtpcb 80 454 0 454 11 10 1 1 0 8 1 rtentry 112 398 0 353 3 1 2 2 0 8 0 unpcb 120 3323 0 3315 1 0 1 1 0 8 0 syncache 264 4 0 4 1 1 0 1 0 8 0 tcpqe 32 6907 0 6907 4 4 0 2 0 8 0 tcpcb 544 2237 0 2233 1 0 1 1 0 8 0 inpcb 280 6125 0 6120 4 3 1 2 0 8 0 rttmr 72 3 0 3 3 3 0 1 0 8 0 nd6 48 96 0 90 1 0 1 1 0 8 0 pkpcb 40 51 0 51 16 16 0 1 0 8 0 swfcl 56 1 0 0 1 0 1 1 0 8 0 ppxss 1128 197 0 197 21 21 0 1 0 8 0 pffrag 232 11 0 11 6 6 0 1 0 482 0 pffrnode 88 11 0 11 6 6 0 1 0 8 0 pffrent 40 26 0 26 6 6 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 265 0 242 1 0 1 1 0 8 0 pfstkey 112 266 0 243 3 1 2 2 0 8 0 pfstate 328 266 0 243 5 2 3 4 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 1578 0 1383 19 6 13 13 0 8 0 art_table 32 1579 0 1383 2 0 2 2 0 8 0 art_node 16 383 0 342 1 0 1 1 0 8 0 sysvmsgpl 40 14 0 10 1 0 1 1 0 8 0 semapl 112 1116 0 1106 1 0 1 1 0 8 0 shmpl 112 138 0 10 4 0 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 17510 0 16063 47 0 47 47 0 8 0 ffsino 272 17510 0 16063 97 0 97 97 0 8 0 nchpl 144 32278 0 30643 62 0 62 62 0 8 0 uvmvnodes 72 6555 0 0 120 0 120 120 0 8 0 vnodes 200 6555 0 0 345 0 345 345 0 8 0 namei 1024 105518 0 105518 2 1 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scsiplug 64 25 0 25 17 16 1 1 0 8 1 scxspl 192 94315 0 94315 42 41 1 7 0 8 1 plimitpl 152 1019 0 1012 1 0 1 1 0 8 0 sigapl 432 10790 0 10777 3 1 2 3 0 8 0 futexpl 56 134664 0 134664 1 0 1 1 0 8 1 knotepl 112 2112 0 2093 1 0 1 1 0 8 0 kqueuepl 104 2053 0 2051 1 0 1 1 0 8 0 pipepl 112 5798 0 5779 9 8 1 2 0 8 0 fdescpl 488 10791 0 10777 3 0 3 3 0 8 0 filepl 152 62625 0 62530 31 26 5 7 0 8 1 lockfpl 104 3253 0 3253 6 5 1 1 0 8 1 lockfspl 48 1094 0 1094 6 5 1 1 0 8 1 sessionpl 112 56 0 48 1 0 1 1 0 8 0 pgrppl 48 175 0 167 1 0 1 1 0 8 0 ucredpl 96 11831 0 11823 1 0 1 1 0 8 0 zombiepl 144 10784 0 10784 2 1 1 1 0 8 1 processpl 896 10815 0 10784 4 0 4 4 0 8 0 procpl 632 32543 0 32499 21 17 4 5 0 8 0 srpgc 64 63 0 63 28 28 0 1 0 8 0 sosppl 128 152 0 152 26 25 1 1 0 8 1 sockpl 384 10081 0 10069 31 29 2 4 0 8 0 mcl64k 65536 277 0 0 33 10 23 33 0 8 1 mcl16k 16384 13 0 0 2 0 2 2 0 8 0 mcl12k 12288 41 0 0 2 0 2 2 0 8 0 mcl9k 9216 25 0 0 2 0 2 2 0 8 0 mcl8k 8192 25 0 0 4 1 3 3 0 8 0 mcl4k 4096 19 0 0 3 0 3 3 0 8 0 mcl2k2 2112 9 0 0 1 0 1 1 0 8 0 mcl2k 2048 241 0 0 27 10 17 27 0 8 0 mtagpl 80 63 0 0 1 0 1 1 0 8 0 mbufpl 256 768 0 0 31 2 29 29 0 8 0 bufpl 256 28156 0 21137 439 0 439 439 0 8 0 anonpl 16 970840 0 958436 188 129 59 72 0 124 0 amapchunkpl 152 63823 0 63716 87 82 5 18 0 158 0 amappl16 192 51225 0 50471 252 205 47 51 0 8 8 amappl15 184 1934 0 1933 6 5 1 1 0 8 0 amappl14 176 3101 0 3096 1 0 1 1 0 8 0 amappl13 168 1768 0 1767 1 0 1 1 0 8 0 amappl12 160 894 0 892 2 1 1 1 0 8 0 amappl11 152 1154 0 1144 1 0 1 1 0 8 0 amappl10 144 915 0 909 1 0 1 1 0 8 0 amappl9 136 3182 0 3178 1 0 1 1 0 8 0 amappl8 128 2694 0 2655 4 2 2 2 0 8 0 amappl7 120 959 0 948 1 0 1 1 0 8 0 amappl6 112 1056 0 1050 1 0 1 1 0 8 0 amappl5 104 1276 0 1265 1 0 1 1 0 8 0 amappl4 96 10704 0 10669 2 1 1 2 0 8 0 amappl3 88 3147 0 3137 1 0 1 1 0 8 0 amappl2 80 86593 0 86523 3 0 3 3 0 8 0 amappl1 72 238511 0 238096 25 15 10 20 0 8 0 amappl 80 33354 0 33318 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 139 0 10 3 0 3 3 0 8 0 uaddrrnd 24 10791 0 10777 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 10791 0 10777 1 0 1 1 0 8 0 vmmpekpl 168 82213 0 82182 3 1 2 2 0 8 0 vmmpepl 168 1315915 0 1314074 428 327 101 113 0 357 14 vmsppl 368 10790 0 10777 2 0 2 2 0 8 0 pdppl 4096 21589 0 21554 7 2 5 6 0 8 0 pvpl 32 2600598 0 2585041 465 317 148 174 0 265 7 pmappl 232 10790 0 10777 2 1 1 2 0 8 0 extentpl 40 41 0 26 1 0 1 1 0 8 0 phpool 112 675 0 35 19 0 19 19 0 8 0