witness: lock order reversal: 1st 0xfffffd807f0048b8 vmmaplk (&map->lock) 2nd 0xfffffd8064fcef78 inode (&ip->i_lock) lock order "&ip->i_lock"(rrwlock) -> "&map->lock"(rwlock) first seen at: #0 witness_checkorder+0x69c witness_lock_order_check sys/kern/subr_witness.c:2441 [inline] #0 witness_checkorder+0x69c sys/kern/subr_witness.c:872 #1 rw_enter+0xd4 #2 vm_map_lock_ln+0x10d sys/uvm/uvm_map.c:5406 #3 uvm_map+0x2da sys/uvm/uvm_map.c:1233 #4 km_alloc+0x18b sys/uvm/uvm_km.c:908 #5 pool_multi_alloc_ni+0xd0 sys/kern/subr_pool.c:1692 #6 pool_p_alloc+0x74 pool_allocator_alloc sys/kern/subr_pool.c:1606 [inline] #6 pool_p_alloc+0x74 sys/kern/subr_pool.c:927 #7 pool_do_get+0x10f sys/kern/subr_pool.c:712 #8 pool_get+0xeb sys/kern/subr_pool.c:581 #9 ufsdirhash_build+0x3ea sys/ufs/ufs/ufs_dirhash.c:180 #10 ufs_lookup+0x2a1 sys/ufs/ufs/ufs_lookup.c:200 #11 VOP_LOOKUP+0x5b sys/kern/vfs_vops.c:91 #12 vfs_lookup+0x7a6 sys/kern/vfs_lookup.c:568 #13 namei+0x63c sys/kern/vfs_lookup.c:249 #14 start_init+0xc9 check_console sys/kern/init_main.c:596 [inline] #14 start_init+0xc9 sys/kern/init_main.c:636 #15 proc_trampoline+0x1c lock order "&map->lock"(rwlock) -> "&ip->i_lock"(rrwlock) first seen at: #0 witness_checkorder+0x69c witness_lock_order_check sys/kern/subr_witness.c:2441 [inline] #0 witness_checkorder+0x69c sys/kern/subr_witness.c:872 #1 rw_enter+0xd4 #2 rrw_enter+0x88 sys/kern/kern_rwlock.c:453 #3 VOP_LOCK+0xf9 sys/kern/vfs_vops.c:615 #4 vn_lock+0x81 sys/kern/vfs_vnops.c:571 #5 uvn_io+0x2c8 sys/uvm/uvm_vnode.c:1189 #6 uvn_get+0x226 sys/uvm/uvm_vnode.c:1049 #7 uvm_fault+0x11cc sys/uvm/uvm_fault.c:1023 #8 uvm_fault_wire+0x70 sys/uvm/uvm_fault.c:1295 #9 uvm_map_pageable_wire+0x2dd sys/uvm/uvm_map.c:2358 #10 sys_mlock+0x185 sys/uvm/uvm_mmap.c:765 #11 syscall+0x4a4 mi_syscall sys/sys/syscall_mi.h:92 [inline] #11 syscall+0x4a4 sys/arch/amd64/amd64/trap.c:555 #12 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(fffffd8064fcef78,9,0) at witness_checkorder+0x1009 witness_debugger sys/kern/subr_witness.c:2504 [inline] witness_checkorder(fffffd8064fcef78,9,0) at witness_checkorder+0x1009 sys/kern/subr_witness.c:1086 rw_enter(fffffd8064fcef68,81) at rw_enter+0xd4 rrw_enter(fffffd8064fcef68,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:453 VOP_LOCK(fffffd80630f2758,81) at VOP_LOCK+0xf9 sys/kern/vfs_vops.c:615 vn_lock(fffffd80630f2758,81) at vn_lock+0x81 sys/kern/vfs_vnops.c:571 uvn_io(fffffd8062cdb5b8,ffff800024fcb7e8,1,2,0) at uvn_io+0x2c8 sys/uvm/uvm_vnode.c:1189 uvn_get(fffffd8062cdb5b8,0,ffff800024fcba40,ffff800024fcb9d4,0,1) at uvn_get+0x226 sys/uvm/uvm_vnode.c:1049 uvm_fault(fffffd807f0048a0,20002000,2,1) at uvm_fault+0x11cc sys/uvm/uvm_fault.c:1023 uvm_fault_wire(fffffd807f0048a0,20002000,20003000,1) at uvm_fault_wire+0x70 sys/uvm/uvm_fault.c:1295 uvm_map_pageable_wire(fffffd807f0048a0,fffffd806736c700,fffffd80678bb748,ffff800022f90000,0,0) at uvm_map_pageable_wire+0x2dd sys/uvm/uvm_map.c:2358 sys_mlock(ffff800020aa1180,ffff800024fcbc38,ffff800024fcbc80) at sys_mlock+0x185 sys/uvm/uvm_mmap.c:765 syscall(ffff800024fcbd00) at syscall+0x4a4 mi_syscall sys/sys/syscall_mi.h:92 [inline] syscall(ffff800024fcbd00) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:555 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x286281f0570, count: -14 ddb{0}> show registers rdi 0x3 rsi 0x3ffff acpi_pdirpa+0x2be67 rbp 0xffff800024fcb460 rbx 0x3 rdx 0x40000 acpi_pdirpa+0x2be68 rcx 0xffff800022f90000 rax 0xffff800000a4d8c0 r8 0xffffffff81b6af72 witness_checkorder+0xfe2 r9 0x5 r10 0x3 r11 0x3e071ef9e52f4507 r12 0xfffffd800297b100 r13 0 r14 0xffffffff825e93a0 w_lodata+0x42630 r15 0xffffffff825fbd50 w_lodata+0x54fe0 rip 0xffffffff819657f8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800024fcb450 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.1) pid=151087 stat=onproc flags process=10 proc=4000000 pri=86, usrpri=86, nice=20 forw=0xffffffffffffffff, list=0xffff800020aa18e8,0xffffffff82659068 process=0xffff800020a9bc50 user=0xffff800024fc6000, vmspace=0xfffffd807f0048a0 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 72579 327333 13434 32767 2 0x10 syz-executor.0 72579 155239 13434 32767 3 0x4000090 fsleep syz-executor.0 45220 516576 15160 32767 7 0x10 syz-executor.1 45220 208139 15160 32767 3 0x4000090 ttyout syz-executor.1 *45220 151087 15160 32767 7 0x4000010 syz-executor.1 15160 125427 51193 32767 3 0x90 nanosleep syz-executor.1 51193 201706 6911 0 3 0x82 wait syz-executor.1 19165 131797 0 0 3 0x14200 bored sosplice 13434 249480 41922 32767 3 0x90 nanosleep syz-executor.0 41922 60853 6911 0 3 0x82 wait syz-executor.0 6911 168091 48641 0 3 0x82 thrsleep syz-fuzzer 6911 285956 48641 0 3 0x4000082 thrsleep syz-fuzzer 6911 227002 48641 0 3 0x4000082 thrsleep syz-fuzzer 6911 38989 48641 0 3 0x4000082 thrsleep syz-fuzzer 6911 78076 48641 0 3 0x4000082 thrsleep syz-fuzzer 6911 210286 48641 0 3 0x4000082 thrsleep syz-fuzzer 6911 324195 48641 0 3 0x4000082 thrsleep syz-fuzzer 6911 270070 48641 0 3 0x4000082 thrsleep syz-fuzzer 6911 129298 48641 0 3 0x4000082 thrsleep syz-fuzzer 6911 221355 48641 0 3 0x4000082 kqread syz-fuzzer 48641 460584 53680 0 3 0x10008a pause ksh 53680 438739 2080 0 3 0x92 select sshd 49964 228358 1 0 3 0x100083 ttyin getty 2080 85984 1 0 3 0x80 select sshd 96889 439295 67548 73 3 0x100090 kqread syslogd 67548 148328 1 0 3 0x100082 netio syslogd 19980 222786 1 77 3 0x100090 poll dhclient 82892 198641 1 0 3 0x80 poll dhclient 28988 16311 0 0 2 0x14200 zerothread 72542 105277 0 0 3 0x14200 aiodoned aiodoned 79439 192937 0 0 3 0x14200 syncer update 99046 340202 0 0 3 0x14200 cleaner cleaner 98914 79266 0 0 3 0x14200 reaper reaper 72383 495450 0 0 3 0x14200 pgdaemon pagedaemon 48732 368535 0 0 3 0x14200 bored crynlk 34388 124512 0 0 3 0x14200 bored crypto 69576 167737 0 0 3 0x14200 bored viomb 96605 167901 0 0 3 0x40014200 acpi0 acpi0 7083 309103 0 0 3 0x40014200 idle1 255 448297 0 0 3 0x14200 bored softnet 8760 37114 0 0 3 0x14200 bored systqmp 68306 12732 0 0 3 0x14200 bored systq 70878 448123 0 0 3 0x40014200 bored softclock 90792 397314 0 0 3 0x40014200 idle0 71079 336030 0 0 3 0x14200 bored smr 1 381090 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 45220 (syz-executor.1) thread 0xffff800020aa1180 (151087) shared rwlock vmmaplk r = 0 (0xfffffd807f0048b8) #0 witness_lock+0x52e sys/kern/subr_witness.c:1163 #1 rw_enter+0x453 sys/kern/kern_rwlock.c:309 #2 vm_map_lock_ln+0x10d sys/uvm/uvm_map.c:5406 #3 uvm_map_pageable+0x11d sys/uvm/uvm_map.c:2454 #4 sys_mlock+0x185 sys/uvm/uvm_mmap.c:765 #5 syscall+0x4a4 mi_syscall sys/sys/syscall_mi.h:92 [inline] #5 syscall+0x4a4 sys/arch/amd64/amd64/trap.c:555 #6 Xsyscall+0x128 exclusive kernel_lock &kernel_lock r = 0 (0xffffffff82657328) #0 witness_lock+0x52e sys/kern/subr_witness.c:1163 #1 syscall+0x400 mi_syscall sys/sys/syscall_mi.h:83 [inline] #1 syscall+0x400 sys/arch/amd64/amd64/trap.c:555 #2 Xsyscall+0x128 ddb{0}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 9498 6343K 6343K 78643K 10781 0 pcb 13 10K 12K 78643K 15 0 rtable 109 3K 3K 78643K 2232 0 ifaddr 39 10K 10K 78643K 378 0 counters 39 33K 33K 78643K 39 0 ioctlops 0 0K 2K 78643K 144 0 iov 0 0K 64K 78643K 4158 0 mount 1 1K 1K 78643K 1 0 vnodes 1215 76K 76K 78643K 2380 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 5K 78643K 36 0 VM map 2 1K 1K 78643K 2 0 sem 12 1K 1K 78643K 19074 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1810 197K 290K 78643K 12817 0 file desc 8 25K 33K 78643K 4675 0 sigio 0 0K 0K 78643K 68 0 proc 48 50K 83K 78643K 2574 0 subproc 34 2K 2K 78643K 850 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 1K 78643K 1689 0 in_multi 33 2K 2K 78643K 662 0 ether_multi 1 0K 0K 78643K 15 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 174 768K 768K 78643K 174 0 exec 0 0K 1K 78643K 1057 0 pagedep 1 8K 8K 78643K 1 0 inodedep 1 32K 32K 78643K 1 0 newblk 1 0K 0K 78643K 1 0 VM swap 7 26K 26K 78643K 7 0 UVM amap 144 33K 33K 78643K 14511 0 UVM aobj 130 4K 4K 78643K 130 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 165 0 NDP 5 0K 0K 78643K 153 0 temp 106 3034K 3107K 78643K 18282 0 kqueue 0 0K 0K 78643K 62 0 SYN cache 2 16K 16K 78643K 2 0 ddb{0}> show all pools Name Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle arp 64 107 0 99 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtpcb 80 373 0 371 1 0 1 1 0 8 0 rtentry 112 530 0 484 2 0 2 2 0 8 0 unpcb 120 12095 0 12083 7 6 1 2 0 8 0 syncache 264 25 0 25 11 11 0 1 0 8 0 sackhl 24 10 0 10 6 6 0 1 0 8 0 tcpqe 32 33 0 33 9 9 0 1 0 8 0 tcpcb 544 4201 0 4196 35 26 9 11 0 8 8 ipq 40 28 0 28 10 10 0 1 0 8 0 ipqe 40 860 0 860 10 10 0 1 0 8 0 inpcb 280 8753 0 8743 37 28 9 9 0 8 8 ip6q 72 3 0 3 3 3 0 1 0 8 0 ip6af 40 8 0 8 3 3 0 1 0 8 0 nd6 48 100 0 96 1 0 1 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 2393 0 2177 14 0 14 14 0 8 0 art_table 32 2394 0 2177 2 0 2 2 0 8 0 art_node 16 529 0 487 1 0 1 1 0 8 0 sysvmsgpl 40 161 0 156 1 0 1 1 0 8 0 semapl 112 19070 0 19060 1 0 1 1 0 8 0 shmpl 112 128 0 0 4 0 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 7978 0 6574 46 0 46 46 0 8 0 ffsino 272 7978 0 6574 94 0 94 94 0 8 0 nchpl 144 15178 0 13570 60 0 60 60 0 8 0 uvmvnodes 72 5926 0 0 108 0 108 108 0 8 0 vnodes 208 5926 0 0 312 0 312 312 0 8 0 namei 1024 69063 0 69063 1 0 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scxspl 192 40344 0 40344 26 23 3 4 0 8 3 plimitpl 152 2268 0 2259 1 0 1 1 0 8 0 sigapl 432 4702 0 4686 3 1 2 3 0 8 0 futexpl 56 392584 0 392583 1 0 1 1 0 8 0 knotepl 112 1167 0 1148 4 3 1 2 0 8 0 kqueuepl 104 2993 0 2991 12 8 4 4 0 8 3 pipepl 160 17004 0 16985 9 7 2 2 0 8 1 fdescpl 488 4703 0 4686 3 0 3 3 0 8 0 filepl 152 52171 0 52065 51 39 12 14 0 8 7 lockfpl 104 4224 0 4223 1 0 1 1 0 8 0 lockfspl 48 2046 0 2045 1 0 1 1 0 8 0 sessionpl 112 65 0 55 1 0 1 1 0 8 0 pgrppl 48 123 0 113 1 0 1 1 0 8 0 ucredpl 96 21661 0 21652 1 0 1 1 0 8 0 zombiepl 144 4686 0 4686 1 0 1 1 0 8 1 processpl 904 4720 0 4686 4 0 4 4 0 8 0 procpl 632 11534 0 11488 8 3 5 5 0 8 0 srpgc 64 96 0 96 18 17 1 1 0 8 1 sosppl 128 78 0 78 16 15 1 1 0 8 1 sockpl 384 23133 0 23111 62 51 11 14 0 8 8 mcl64k 65536 27 0 0 3 0 3 3 0 8 0 mcl16k 16384 25 0 0 4 1 3 3 0 8 0 mcl12k 12288 22 0 0 2 0 2 2 0 8 0 mcl9k 9216 14 0 0 1 0 1 1 0 8 0 mcl8k 8192 29 0 0 3 0 3 3 0 8 0 mcl4k 4096 17 0 0 3 0 3 3 0 8 0 mcl2k2 2112 11 0 0 1 0 1 1 0 8 0 mcl2k 2048 171 0 0 18 3 15 18 0 8 0 mtagpl 80 1 0 0 1 0 1 1 0 8 0 mbufpl 256 605 0 0 21 0 21 21 0 8 0 bufpl 280 12893 0 5827 506 0 506 506 0 8 0 anonpl 16 546914 0 529365 176 100 76 81 0 125 5 amapchunkpl 152 29792 0 29529 38 27 11 13 0 158 0 amappl16 192 18987 0 18115 147 99 48 56 0 8 4 amappl15 184 873 0 869 1 0 1 1 0 8 0 amappl14 176 2553 0 2544 1 0 1 1 0 8 0 amappl13 168 265 0 265 6 6 0 1 0 8 0 amappl12 160 180 0 180 7 7 0 1 0 8 0 amappl11 152 339 0 328 1 0 1 1 0 8 0 amappl10 144 185 0 184 1 0 1 1 0 8 0 amappl9 136 1544 0 1539 1 0 1 1 0 8 0 amappl8 128 1006 0 951 2 0 2 2 0 8 0 amappl7 120 538 0 522 1 0 1 1 0 8 0 amappl6 112 227 0 216 1 0 1 1 0 8 0 amappl5 104 4391 0 4380 1 0 1 1 0 8 0 amappl4 96 4911 0 4881 1 0 1 1 0 8 0 amappl3 88 560 0 551 1 0 1 1 0 8 0 amappl2 80 34059 0 33982 3 1 2 3 0 8 0 amappl1 72 129300 0 128832 24 14 10 20 0 8 0 amappl 80 12588 0 12540 2 0 2 2 0 84 0 dma4096 4096 1 0 1 1 1 0 1 0 8 0 dma1024 1024 1 0 0 1 0 1 1 0 8 0 dma256 256 6 0 6 1 1 0 1 0 8 0 dma128 128 253 0 253 1 1 0 1 0 8 0 dma64 64 6 0 6 1 1 0 1 0 8 0 dma32 32 7 0 7 1 1 0 1 0 8 0 dma16 16 18 0 17 1 0 1 1 0 8 0 aobjpl 64 129 0 0 3 0 3 3 0 8 0 uaddrrnd 24 4703 0 4686 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 4703 0 4686 1 0 1 1 0 8 0 vmmpekpl 168 64278 0 64250 2 0 2 2 0 8 0 vmmpepl 168 632638 0 630382 228 104 124 128 0 357 25 vmsppl 368 4702 0 4686 2 0 2 2 0 8 0 pdppl 4096 9413 0 9372 6 0 6 6 0 8 0 pvpl 32 1469719 0 1448300 382 194 188 193 0 265 15 pmappl 232 4702 0 4686 4 3 1 2 0 8 0 extentpl 40 50 0 32 1 0 1 1 0 8 0 phpool 112 215 0 32 6 0 6 6 0 8 0