login: witness: lock order reversal: 1st 0xfffffd8067db6818 inode (&ip->i_lock) 2nd 0xfffffd807d306be8 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(fffffd807d306be8,9,0) at witness_checkorder+0xffc witness_debugger sys/kern/subr_witness.c:2506 [inline] witness_checkorder(fffffd807d306be8,9,0) at witness_checkorder+0xffc sys/kern/subr_witness.c:1086 rw_enter_write(fffffd807d306bd8) at rw_enter_write+0x5b sys/kern/kern_rwlock.c:125 diskmapioctl(5a00,c0106477,ffff800020b3d0d0,1,ffff800020ab0018) at diskmapioctl+0x237 sys/dev/diskmap.c:106 VOP_IOCTL(fffffd806fa7e648,c0106477,ffff800020b3d0d0,1,fffffd807f7c6900,ffff800020ab0018) at VOP_IOCTL+0x88 sys/kern/vfs_vops.c:290 vn_ioctl(fffffd8067be3bf8,c0106477,ffff800020b3d0d0,ffff800020ab0018) at vn_ioctl+0xb7 sys/kern/vfs_vnops.c:524 sys_ioctl(ffff800020ab0018,ffff800020b3d1e8,ffff800020b3d250) at sys_ioctl+0x5b8 syscall(ffff800020b3d2c0) at syscall+0x552 mi_syscall sys/sys/syscall_mi.h:92 [inline] syscall(ffff800020b3d2c0) at syscall+0x552 sys/arch/amd64/amd64/trap.c:555 Xsyscall(6,0,ffffffffffffff1b,0,3,9c58f2a4010) at Xsyscall+0x128 end of kernel end trace frame: 0x9c80810bcf0, count: -9 ddb{1}> show registers rdi 0x3 rsi 0x3ffff acpi_pdirpa+0x2be67 rbp 0xffff800020b3cc90 rbx 0x3 rdx 0x40000 acpi_pdirpa+0x2be68 rcx 0xffff800021b5e000 rax 0xffff800000a8f400 r8 0xffffffff81552515 witness_checkorder+0xfd5 r9 0x5 r10 0x3 r11 0x8562549a3a2cb5f4 r12 0xfffffd80029b4c00 r13 0 r14 0xffffffff825af2b0 w_lodata+0x45650 r15 0xffffffff825bdd20 w_lodata+0x540c0 rip 0xffffffff81f8aae8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800020b3cc80 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{1}> show proc PROC (syz-executor.1) pid=425277 stat=onproc flags process=0 proc=4000000 pri=32, usrpri=86, nice=20 forw=0xffffffffffffffff, list=0xffff800020ab0c70,0xffff800020ab02a0 process=0xffff800020adca80 user=0xffff800020b38000, vmspace=0xfffffd807f00ccf0 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND 41804 319394 27184 0 2 0 syz-executor.0 41804 273475 27184 0 3 0x4000080 ttyout syz-executor.0 41804 418226 27184 0 3 0x4000080 fsleep syz-executor.0 71095 469602 33311 0 7 0 syz-executor.1 *71095 425277 33311 0 7 0x4000000 syz-executor.1 71095 224014 33311 0 3 0x4000080 fsleep syz-executor.1 27184 269198 19151 0 3 0x82 nanosleep syz-executor.0 7640 122811 1 0 3 0x100083 ttyin getty 27107 410127 0 0 3 0x14200 acct acct 33311 286422 19151 0 3 0x82 nanosleep syz-executor.1 28325 223672 0 0 3 0x14200 bored sosplice 19151 186943 12142 0 3 0x82 thrsleep syz-fuzzer 19151 508456 12142 0 3 0x4000082 thrsleep syz-fuzzer 19151 331776 12142 0 3 0x4000082 thrsleep syz-fuzzer 19151 47387 12142 0 3 0x4000082 kqread syz-fuzzer 19151 238690 12142 0 3 0x4000082 thrsleep syz-fuzzer 19151 270411 12142 0 3 0x4000082 thrsleep syz-fuzzer 19151 270291 12142 0 3 0x4000082 thrsleep syz-fuzzer 19151 278655 12142 0 3 0x4000082 thrsleep syz-fuzzer 19151 333023 12142 0 3 0x4000082 thrsleep syz-fuzzer 19151 118732 12142 0 3 0x4000082 thrsleep syz-fuzzer 12142 251343 16312 0 3 0x10008a pause ksh 16312 119187 44420 0 3 0x92 select sshd 44420 515806 1 0 3 0x80 select sshd 83306 96097 65591 74 3 0x100092 bpf pflogd 65591 402782 1 0 3 0x80 netio pflogd 86696 186130 49477 73 3 0x100090 kqread syslogd 49477 119496 1 0 3 0x100082 netio syslogd 24470 181324 1 77 3 0x100090 poll dhclient 67735 405393 1 0 3 0x80 poll dhclient 94352 373115 0 0 2 0x14200 zerothread 45235 360315 0 0 3 0x14200 aiodoned aiodoned 26191 56697 0 0 3 0x14200 syncer update 3858 403001 0 0 3 0x14200 cleaner cleaner 85356 260483 0 0 3 0x14200 reaper reaper 8005 424141 0 0 3 0x14200 pgdaemon pagedaemon 9030 223279 0 0 3 0x14200 bored crynlk 98670 23029 0 0 3 0x14200 bored crypto 7454 336211 0 0 3 0x40014200 acpi0 acpi0 93998 76358 0 0 3 0x40014200 idle1 56199 345519 0 0 3 0x14200 bored softnet 95874 517236 0 0 3 0x14200 bored systqmp 83653 33808 0 0 3 0x14200 bored systq 79607 365679 0 0 3 0x40014200 bored softclock 77971 432931 0 0 3 0x40014200 idle0 89339 351275 0 0 3 0x14200 bored smr 1 361931 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{1}> show all locks Process 71095 (syz-executor.1) thread 0xffff800020ab0018 (425277) exclusive rrwlock inode r = 0 (0xfffffd8067db6818) #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 (0xffffffff82629140) #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 9553 6456K 7145K 78643K 14780 0 0 pcb 13 8K 8K 78643K 149 0 0 rtable 108 4K 4K 78643K 579 0 0 ifaddr 68 14K 15K 78643K 211 0 0 counters 39 33K 33K 78643K 39 0 0 ioctlops 0 0K 4K 78643K 1567 0 0 iov 0 0K 32K 78643K 155 0 0 mount 1 1K 1K 78643K 1 0 0 vnodes 1209 76K 77K 78643K 2667 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 161 0 0 dirhash 12 2K 2K 78643K 12 0 0 ACPI 1808 196K 290K 78643K 12765 0 0 file desc 6 17K 25K 78643K 1607 0 0 sigio 0 0K 0K 78643K 16 0 0 proc 54 51K 83K 78643K 665 0 0 subproc 32 2K 2K 78643K 68 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 129 0 0 in_multi 33 2K 2K 78643K 114 0 0 ether_multi 1 0K 0K 78643K 10 0 0 mrt 0 0K 0K 78643K 20 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 369 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 101 21K 25K 78643K 5988 0 0 UVM aobj 62 2K 2K 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 1K 78643K 75 0 0 NDP 15 0K 0K 78643K 59 0 0 temp 194 3548K 3616K 78643K 15245 0 0 kqueue 0 0K 0K 78643K 14 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 10 0 4 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtpcb 80 81 0 79 1 0 1 1 0 8 0 rtentry 112 77 0 33 2 0 2 2 0 8 0 unpcb 120 532 0 522 1 0 1 1 0 8 0 syncache 264 4 0 4 1 1 0 1 0 8 0 tcpqe 32 9084 0 9084 2 2 0 2 0 8 0 tcpcb 544 308 0 304 1 0 1 1 0 8 0 inpcb 280 890 0 883 2 1 1 2 0 8 0 rttmr 72 8 0 8 5 5 0 1 0 8 0 nd6 48 12 0 6 1 0 1 1 0 8 0 pkpcb 40 24 0 24 6 5 1 1 0 8 1 ppxss 1128 28 0 28 3 2 1 1 0 8 1 pffrag 232 4 0 4 2 2 0 1 0 482 0 pffrnode 88 4 0 4 2 2 0 1 0 8 0 pffrent 40 8 0 8 2 2 0 1 0 8 0 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 60 0 20 1 0 1 1 0 8 0 pfstkey 112 60 0 20 2 0 2 2 0 8 0 pfstate 328 60 0 20 4 0 4 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 350 0 159 15 3 12 13 0 8 0 art_table 32 351 0 159 2 0 2 2 0 8 0 art_node 16 74 0 34 1 0 1 1 0 8 0 sysvmsgpl 40 18 0 9 1 0 1 1 0 8 0 semapl 112 159 0 149 1 0 1 1 0 8 0 shmpl 112 63 0 3 2 0 2 2 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 3932 0 2514 47 0 47 47 0 8 0 ffsino 272 3932 0 2514 96 0 96 96 0 8 0 nchpl 144 6387 0 4757 62 0 62 62 0 8 0 uvmvnodes 72 4978 0 0 91 0 91 91 0 8 0 vnodes 200 4978 0 0 262 0 262 262 0 8 0 namei 1024 19685 0 19685 2 1 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scsiplug 64 3 0 3 1 1 0 1 0 8 0 scxspl 192 17761 0 17761 16 12 4 6 0 8 4 plimitpl 152 152 0 144 1 0 1 1 0 8 0 sigapl 432 1802 0 1786 3 1 2 3 0 8 0 futexpl 56 20316 0 20314 1 0 1 1 0 8 0 knotepl 112 331 0 312 1 0 1 1 0 8 0 kqueuepl 104 337 0 335 1 0 1 1 0 8 0 pipepl 112 992 0 973 4 2 2 2 0 8 1 fdescpl 488 1803 0 1786 5 2 3 3 0 8 0 filepl 152 10521 0 10418 10 4 6 7 0 8 1 lockfpl 104 551 0 551 2 1 1 1 0 8 1 lockfspl 48 193 0 193 2 1 1 1 0 8 1 sessionpl 112 21 0 10 1 0 1 1 0 8 0 pgrppl 48 37 0 26 1 0 1 1 0 8 0 ucredpl 96 1930 0 1921 1 0 1 1 0 8 0 zombiepl 144 1786 0 1786 2 1 1 1 0 8 1 processpl 896 1820 0 1786 4 0 4 4 0 8 0 procpl 632 5083 0 5036 5 0 5 5 0 8 1 srpgc 64 12 0 12 5 5 0 1 0 8 0 sosppl 128 30 0 30 4 3 1 1 0 8 1 sockpl 384 1545 0 1526 7 3 4 4 0 8 2 mcl64k 65536 14 0 0 2 0 2 2 0 8 0 mcl16k 16384 4 0 0 1 0 1 1 0 8 0 mcl12k 12288 14 0 0 2 0 2 2 0 8 0 mcl9k 9216 5 0 0 1 0 1 1 0 8 0 mcl8k 8192 7 0 0 1 0 1 1 0 8 0 mcl4k 4096 7 0 0 1 0 1 1 0 8 0 mcl2k2 2112 8 0 0 1 0 1 1 0 8 0 mcl2k 2048 203 0 0 25 1 24 25 0 8 0 mtagpl 80 34 0 0 1 0 1 1 0 8 0 mbufpl 256 238 0 0 15 1 14 14 0 8 0 bufpl 256 10589 0 3570 439 0 439 439 0 8 0 anonpl 16 160814 0 148501 83 18 65 67 0 124 11 amapchunkpl 152 10338 0 10222 27 21 6 19 0 158 0 amappl16 192 8354 0 7666 58 15 43 47 0 8 8 amappl15 184 628 0 627 1 0 1 1 0 8 0 amappl14 176 65 0 59 1 0 1 1 0 8 0 amappl13 168 6 0 6 1 1 0 1 0 8 0 amappl12 160 789 0 787 2 1 1 1 0 8 0 amappl11 152 63 0 48 1 0 1 1 0 8 0 amappl10 144 240 0 232 1 0 1 1 0 8 0 amappl9 136 623 0 620 1 0 1 1 0 8 0 amappl8 128 174 0 156 1 0 1 1 0 8 0 amappl7 120 198 0 190 1 0 1 1 0 8 0 amappl6 112 58 0 52 1 0 1 1 0 8 0 amappl5 104 939 0 923 1 0 1 1 0 8 0 amappl4 96 2072 0 2041 2 1 1 2 0 8 0 amappl3 88 321 0 310 1 0 1 1 0 8 0 amappl2 80 14081 0 13999 3 1 2 3 0 8 0 amappl1 72 47141 0 46669 27 17 10 20 0 8 0 amappl 80 5389 0 5346 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 3 1 0 1 1 0 8 0 uaddrrnd 24 1803 0 1786 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 1803 0 1786 1 0 1 1 0 8 0 vmmpekpl 168 16958 0 16923 2 0 2 2 0 8 0 vmmpepl 168 223173 0 221231 153 57 96 104 0 357 11 vmsppl 368 1802 0 1786 2 0 2 2 0 8 0 pdppl 4096 3613 0 3572 7 1 6 6 0 8 0 pvpl 32 469244 0 453662 205 41 164 164 0 265 32 pmappl 232 1802 0 1786 2 1 1 2 0 8 0 extentpl 40 41 0 26 1 0 1 1 0 8 0 phpool 112 615 0 10 18 0 18 18 0 8 0