QQwitness: lock order reversal: 1st 0xfffffd807dd23f78 inode (&ip->i_lock) 2nd 0xfffffd806e666438 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(fffffd806e666438,9,0) at witness_checkorder+0xffc witness_debugger sys/kern/subr_witness.c:2506 [inline] witness_checkorder(fffffd806e666438,9,0) at witness_checkorder+0xffc sys/kern/subr_witness.c:1086 rw_enter_write(fffffd806e666428) at rw_enter_write+0x5b sys/kern/kern_rwlock.c:125 diskmapioctl(5a00,c0106477,ffff800021b9b190,1,ffff800020ace300) at diskmapioctl+0x237 sys/dev/diskmap.c:106 VOP_IOCTL(fffffd806fa78008,c0106477,ffff800021b9b190,1,fffffd807f7c6660,ffff800020ace300) at VOP_IOCTL+0x88 sys/kern/vfs_vops.c:290 vn_ioctl(fffffd807a8a8c78,c0106477,ffff800021b9b190,ffff800020ace300) at vn_ioctl+0xb7 sys/kern/vfs_vnops.c:524 sys_ioctl(ffff800020ace300,ffff800021b9b2a8,ffff800021b9b310) at sys_ioctl+0x5b8 syscall(ffff800021b9b380) at syscall+0x552 mi_syscall sys/sys/syscall_mi.h:92 [inline] syscall(ffff800021b9b380) at syscall+0x552 sys/arch/amd64/amd64/trap.c:555 Xsyscall(6,0,ffffffffffffff1b,0,3,da700798010) at Xsyscall+0x128 end of kernel end trace frame: 0xda984622580, count: -9 ddb{1}> show registers rdi 0x3 rsi 0x3ffff acpi_pdirpa+0x2be67 rbp 0xffff800021b9ad50 rbx 0x3 rdx 0x40000 acpi_pdirpa+0x2be68 rcx 0xffff800021bb0000 rax 0xffff800000a45a40 r8 0xffffffff81756bc5 witness_checkorder+0xfd5 r9 0x5 r10 0x3 r11 0xd2ac97b10c9275a9 r12 0xfffffd80029b8c00 r13 0 r14 0xffffffff825cc3e0 w_lodata+0x36190 r15 0xffffffff825ea7e0 w_lodata+0x54590 rip 0xffffffff8209fa08 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800021b9ad40 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{1}> show proc PROC (syz-executor.1) pid=49426 stat=onproc flags process=0 proc=4000000 pri=32, usrpri=79, nice=20 forw=0xffffffffffffffff, list=0xffff800020acece0,0xffff800020acf458 process=0xffff800020adca80 user=0xffff800021b96000, vmspace=0xfffffd807f00c730 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND 71642 139468 17068 0 2 0 syz-executor.0 71642 2163 17068 0 7 0x4000000 syz-executor.0 13540 486305 28822 0 2 0 syz-executor.1 *13540 49426 28822 0 7 0x4000000 syz-executor.1 13540 421609 28822 0 2 0x4000000 syz-executor.1 17068 320775 48960 0 3 0x82 nanosleep syz-executor.0 51916 8050 1 0 3 0x100083 ttyin getty 28822 75718 48960 0 3 0x82 nanosleep syz-executor.1 84551 80603 0 0 3 0x14200 acct acct 23822 343330 0 0 3 0x14200 bored sosplice 48960 501224 80161 0 3 0x82 thrsleep syz-fuzzer 48960 473332 80161 0 3 0x4000082 nanosleep syz-fuzzer 48960 517118 80161 0 3 0x4000082 thrsleep syz-fuzzer 48960 451167 80161 0 3 0x4000082 thrsleep syz-fuzzer 48960 297302 80161 0 3 0x4000082 thrsleep syz-fuzzer 48960 407363 80161 0 3 0x4000082 thrsleep syz-fuzzer 48960 413737 80161 0 3 0x4000082 thrsleep syz-fuzzer 48960 132916 80161 0 3 0x4000082 thrsleep syz-fuzzer 48960 53898 80161 0 3 0x4000082 kqread syz-fuzzer 48960 183486 80161 0 3 0x4000082 thrsleep syz-fuzzer 80161 448204 74504 0 3 0x10008a pause ksh 74504 82252 78914 0 3 0x92 select sshd 78914 319126 1 0 3 0x80 select sshd 42511 382075 22430 74 3 0x100092 bpf pflogd 22430 297322 1 0 3 0x80 netio pflogd 46270 353669 1402 73 3 0x100090 kqread syslogd 1402 133125 1 0 3 0x100082 netio syslogd 77548 77738 0 0 2 0x14200 zerothread 4447 448634 0 0 3 0x14200 aiodoned aiodoned 70224 209543 0 0 3 0x14200 syncer update 84392 407207 0 0 3 0x14200 cleaner cleaner 445 264510 0 0 3 0x14200 reaper reaper 89503 433291 0 0 3 0x14200 pgdaemon pagedaemon 50485 396142 0 0 3 0x14200 bored crynlk 55976 506998 0 0 3 0x14200 bored crypto 55747 8755 0 0 3 0x40014200 acpi0 acpi0 53268 463819 0 0 3 0x40014200 idle1 75218 375270 0 0 3 0x14200 bored softnet 2226 232742 0 0 3 0x14200 bored systqmp 18607 146238 0 0 3 0x14200 bored systq 73077 333648 0 0 3 0x40014200 bored softclock 84435 455009 0 0 3 0x40014200 idle0 76193 136673 0 0 3 0x14200 bored smr 1 426827 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{1}> show all locks Process 13540 (syz-executor.1) thread 0xffff800020ace300 (49426) exclusive rrwlock inode r = 0 (0xfffffd807dd23f78) #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 (0xffffffff826491e0) #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 9644 6430K 15004K 78643K 98301 0 0 pcb 13 8K 8K 78643K 2630 0 0 rtable 122 13K 13K 78643K 6586 0 0 ifaddr 100 37K 49K 78643K 3772 0 0 counters 39 33K 33K 78643K 39 0 0 ioctlops 0 0K 4K 78643K 3201 0 0 iov 0 0K 32K 78643K 3392 0 0 mount 1 1K 1K 78643K 1 0 0 vnodes 1190 75K 77K 78643K 34714 0 0 UFS quota 1 32K 32K 78643K 1 0 0 UFS mount 5 36K 36K 78643K 5 0 0 shm 2 1K 9K 78643K 514 0 0 VM map 2 1K 1K 78643K 2 0 0 sem 12 0K 1K 78643K 3962 0 0 dirhash 12 2K 2K 78643K 12 0 0 ACPI 1808 196K 290K 78643K 12765 0 0 file desc 6 17K 25K 78643K 35549 0 0 sigio 0 0K 0K 78643K 394 0 0 proc 55 51K 83K 78643K 7938 0 0 subproc 32 2K 2K 78643K 1835 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 3097 0 0 in_multi 33 2K 2K 78643K 2265 0 0 ether_multi 1 0K 0K 78643K 161 0 0 mrt 0 0K 0K 78643K 108 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 4494 0 0 pfkey data 0 0K 4K 78643K 2 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 130 23K 33K 78643K 112140 0 0 UVM aobj 130 4K 4K 78643K 159 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 2436 0 0 NDP 25 0K 1K 78643K 1288 0 0 temp 264 3558K 4198K 78643K 513977 0 0 kqueue 0 0K 0K 78643K 264 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 222 0 216 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtpcb 80 1379 0 1379 31 31 0 1 0 8 0 rtentry 112 1256 0 1212 5 3 2 2 0 8 0 unpcb 120 10694 0 10686 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 9293 0 9293 3 3 0 2 0 8 0 tcpcb 544 5606 0 5602 1 0 1 1 0 8 0 inpcb 280 16114 0 16105 53 51 2 2 0 8 1 rttmr 72 19 0 19 16 16 0 1 0 8 0 nd6 48 321 0 315 2 1 1 1 0 8 0 pkpcb 40 171 0 171 57 56 1 1 0 8 1 swfcl 56 10 0 0 1 0 1 1 0 8 0 ppxss 1128 809 0 807 43 42 1 1 0 8 0 pffrag 232 64 0 64 33 33 0 1 0 482 0 pffrnode 88 64 0 64 33 33 0 1 0 8 0 pffrent 40 170 0 170 33 33 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 834 0 818 1 0 1 1 0 8 0 pfstkey 112 834 0 818 3 1 2 2 0 8 0 pfstate 328 834 0 818 11 8 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 5167 0 4970 35 22 13 14 0 8 0 art_table 32 5168 0 4970 3 1 2 2 0 8 0 art_node 16 1224 0 1184 1 0 1 1 0 8 0 sysvmsgpl 40 20 0 13 1 0 1 1 0 8 0 semapl 112 3960 0 3950 1 0 1 1 0 8 0 shmpl 112 157 0 29 4 0 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 58213 0 56680 52 2 50 50 0 8 0 ffsino 272 58213 0 56680 104 1 103 103 0 8 0 nchpl 144 107355 0 105721 62 0 62 62 0 8 0 uvmvnodes 72 9663 0 0 176 0 176 176 0 8 0 vnodes 200 9663 0 0 509 0 509 509 0 8 0 namei 1024 353267 0 353267 11 10 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scsiplug 64 69 0 69 43 42 1 1 0 8 1 scxspl 192 309721 0 309721 117 116 1 7 0 8 1 plimitpl 152 3131 0 3123 1 0 1 1 0 8 0 sigapl 432 35446 0 35432 3 1 2 3 0 8 0 futexpl 56 446023 0 446023 6 5 1 1 0 8 1 knotepl 112 7541 0 7522 2 1 1 2 0 8 0 kqueuepl 104 7018 0 7016 1 0 1 1 0 8 0 pipepl 112 19306 0 19287 36 35 1 2 0 8 0 fdescpl 488 35447 0 35432 3 0 3 3 0 8 0 filepl 152 205899 0 205804 85 80 5 7 0 8 1 lockfpl 104 11213 0 11213 11 10 1 1 0 8 1 lockfspl 48 3806 0 3806 11 10 1 1 0 8 1 sessionpl 112 135 0 126 1 0 1 1 0 8 0 pgrppl 48 461 0 452 1 0 1 1 0 8 0 ucredpl 96 39592 0 39581 1 0 1 1 0 8 0 zombiepl 144 35440 0 35440 11 10 1 1 0 8 1 processpl 896 35472 0 35440 4 0 4 4 0 8 0 procpl 632 105976 0 105932 18 13 5 5 0 8 0 srpgc 64 229 0 229 96 96 0 1 0 8 0 sosppl 128 408 0 408 100 99 1 1 0 8 1 sockpl 384 28689 0 28677 66 64 2 4 0 8 0 mcl64k 65536 1614 0 0 191 112 79 129 0 8 1 mcl16k 16384 57 0 0 7 4 3 3 0 8 0 mcl12k 12288 97 0 0 3 1 2 2 0 8 0 mcl9k 9216 97 0 0 4 2 2 2 0 8 0 mcl8k 8192 57 0 0 6 3 3 3 0 8 0 mcl4k 4096 49 0 0 4 1 3 3 0 8 0 mcl2k2 2112 10 0 0 1 0 1 1 0 8 0 mcl2k 2048 360 0 0 24 12 12 24 0 8 0 mtagpl 80 221 0 0 2 0 2 2 0 8 0 mbufpl 256 2633 0 0 85 13 72 72 0 8 0 bufpl 256 93459 0 83794 605 0 605 605 0 8 0 anonpl 16 3022157 0 3010174 536 477 59 68 0 124 0 amapchunkpl 152 200923 0 200817 143 137 6 18 0 158 0 amappl16 192 171351 0 170673 840 804 36 48 0 8 1 amappl15 184 7715 0 7713 14 13 1 1 0 8 0 amappl14 176 7552 0 7541 1 0 1 1 0 8 0 amappl13 168 5551 0 5551 16 16 0 1 0 8 0 amappl12 160 1906 0 1903 2 1 1 1 0 8 0 amappl11 152 5429 0 5420 1 0 1 1 0 8 0 amappl10 144 5068 0 5062 1 0 1 1 0 8 0 amappl9 136 7270 0 7265 1 0 1 1 0 8 0 amappl8 128 6687 0 6634 5 3 2 2 0 8 0 amappl7 120 5243 0 5235 1 0 1 1 0 8 0 amappl6 112 5094 0 5078 1 0 1 1 0 8 0 amappl5 104 2970 0 2959 1 0 1 1 0 8 0 amappl4 96 34608 0 34575 2 1 1 2 0 8 0 amappl3 88 7675 0 7660 1 0 1 1 0 8 0 amappl2 80 283011 0 282931 3 1 2 3 0 8 0 amappl1 72 748023 0 747595 26 16 10 20 0 8 0 amappl 80 108022 0 107986 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 158 0 29 3 0 3 3 0 8 0 uaddrrnd 24 35447 0 35432 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 35447 0 35432 1 0 1 1 0 8 0 vmmpekpl 168 266236 0 266206 2 0 2 2 0 8 0 vmmpepl 168 4258828 0 4256932 1089 996 93 109 0 357 0 vmsppl 368 35446 0 35432 2 0 2 2 0 8 0 pdppl 4096 70901 0 70864 7 2 5 6 0 8 0 pvpl 32 8119721 0 8104499 1306 1160 146 167 0 265 10 pmappl 232 35446 0 35432 3 2 1 2 0 8 0 extentpl 40 41 0 26 1 0 1 1 0 8 0 phpool 112 1090 0 183 26 0 26 26 0 8 0