witness: lock order reversal: 1st 0xfffffd807f0048b8 vmmaplk (&map->lock) 2nd 0xfffffd8062f8b0a8 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(fffffd8062f8b0a8,9,0) at witness_checkorder+0x1009 witness_debugger sys/kern/subr_witness.c:2504 [inline] witness_checkorder(fffffd8062f8b0a8,9,0) at witness_checkorder+0x1009 sys/kern/subr_witness.c:1086 rw_enter(fffffd8062f8b098,81) at rw_enter+0xd4 rrw_enter(fffffd8062f8b098,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:453 VOP_LOCK(fffffd8066d97828,81) at VOP_LOCK+0xf9 sys/kern/vfs_vops.c:615 vn_lock(fffffd8066d97828,81) at vn_lock+0x81 sys/kern/vfs_vnops.c:571 uvn_io(fffffd80675588c0,ffff800024f716f8,1,2,0) at uvn_io+0x2c8 sys/uvm/uvm_vnode.c:1189 uvn_get(fffffd80675588c0,7000,ffff800024f71950,ffff800024f718e4,0,5) at uvn_get+0x226 sys/uvm/uvm_vnode.c:1049 uvm_fault(fffffd807f0048a0,20007000,2,5) at uvm_fault+0x11cc sys/uvm/uvm_fault.c:1023 uvm_fault_wire(fffffd807f0048a0,20007000,20008000,5) at uvm_fault_wire+0x70 sys/uvm/uvm_fault.c:1295 uvm_map_pageable_wire(fffffd807f0048a0,fffffd8070cd2d38,fffffd8066e27778,ffff800022d5a000,ffffffff81b6d177,0) at uvm_map_pageable_wire+0x2dd sys/uvm/uvm_map.c:2358 sys_mlock(ffff800020a98018,ffff800024f71b48,ffff800024f71b90) at sys_mlock+0x185 sys/uvm/uvm_mmap.c:765 syscall(ffff800024f71c10) at syscall+0x4a4 mi_syscall sys/sys/syscall_mi.h:92 [inline] syscall(ffff800024f71c10) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:555 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x2bb579fde80, count: -14 ddb{0}> show registers rdi 0x3 rsi 0x3ffff acpi_pdirpa+0x2be67 rbp 0xffff800024f71370 rbx 0x3 rdx 0x40000 acpi_pdirpa+0x2be68 rcx 0xffff800022d5a000 rax 0xffff8000009e7540 r8 0xffffffff81b6af72 witness_checkorder+0xfe2 r9 0x5 r10 0x3 r11 0xbd235a05a6d02e6c r12 0xfffffd800297b100 r13 0 r14 0xffffffff825ecd60 w_lodata+0x45ff0 r15 0xffffffff825fbca0 w_lodata+0x54f30 rip 0xffffffff819657f8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800024f71360 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.1) pid=56943 stat=onproc flags process=10 proc=4000000 pri=78, usrpri=78, nice=20 forw=0xffffffffffffffff, list=0xffff800020a98780,0xffffffff82659068 process=0xffff800020aec728 user=0xffff800024f6c000, vmspace=0xfffffd807f0048a0 estcpu=36, cpticks=2, pctcpu=0.0 user=0, sys=0, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 93042 238178 45952 32767 2 0x10 syz-executor.1 *93042 56943 45952 32767 7 0x4000010 syz-executor.1 48605 262592 52047 32767 2 0x10 syz-executor.0 52047 395608 12029 0 3 0x82 wait syz-executor.0 45952 340617 73926 32767 3 0x90 nanosleep syz-executor.1 73926 325823 12029 0 3 0x82 wait syz-executor.1 27309 413338 0 0 3 0x14200 bored sosplice 12029 234577 87005 0 3 0x82 thrsleep syz-fuzzer 12029 31769 87005 0 3 0x4000082 nanosleep syz-fuzzer 12029 278856 87005 0 3 0x4000082 thrsleep syz-fuzzer 12029 305112 87005 0 3 0x4000082 kqread syz-fuzzer 12029 236560 87005 0 7 0x4000002 syz-fuzzer 12029 295260 87005 0 3 0x4000082 thrsleep syz-fuzzer 12029 111031 87005 0 3 0x4000082 thrsleep syz-fuzzer 12029 66179 87005 0 3 0x4000082 thrsleep syz-fuzzer 12029 131298 87005 0 3 0x4000082 thrsleep syz-fuzzer 12029 275379 87005 0 3 0x4000082 thrsleep syz-fuzzer 87005 521113 65210 0 3 0x10008a pause ksh 65210 273724 95948 0 3 0x92 select sshd 76759 13444 1 0 3 0x100083 ttyin getty 95948 11823 1 0 3 0x80 select sshd 10156 101443 37547 73 3 0x100090 kqread syslogd 37547 109833 1 0 3 0x100082 netio syslogd 17026 483031 1 77 3 0x100090 poll dhclient 80312 442136 1 0 3 0x80 poll dhclient 45701 380994 0 0 3 0x14200 pgzero zerothread 79904 164852 0 0 3 0x14200 aiodoned aiodoned 96559 505731 0 0 3 0x14200 syncer update 36995 187591 0 0 3 0x14200 cleaner cleaner 17313 47103 0 0 3 0x14200 reaper reaper 25040 321425 0 0 3 0x14200 pgdaemon pagedaemon 64329 397614 0 0 3 0x14200 bored crynlk 56479 465923 0 0 3 0x14200 bored crypto 86524 326459 0 0 3 0x14200 bored viomb 88867 445262 0 0 3 0x40014200 acpi0 acpi0 81870 202431 0 0 3 0x40014200 idle1 39591 248010 0 0 3 0x14200 bored softnet 30917 424760 0 0 3 0x14200 bored systqmp 20929 342074 0 0 3 0x14200 bored systq 34781 182618 0 0 3 0x40014200 bored softclock 42594 105711 0 0 3 0x40014200 idle0 45263 389574 0 0 3 0x14200 bored smr 1 370208 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 93042 (syz-executor.1) thread 0xffff800020a98018 (56943) 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 9495 6343K 6343K 78643K 10746 0 pcb 13 8K 8K 78643K 13 0 rtable 105 3K 3K 78643K 1931 0 ifaddr 39 10K 10K 78643K 327 0 counters 39 33K 33K 78643K 39 0 ioctlops 0 0K 2K 78643K 89 0 iov 0 0K 32K 78643K 978 0 mount 1 1K 1K 78643K 1 0 vnodes 1215 76K 76K 78643K 2173 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 9K 78643K 304 0 VM map 2 1K 1K 78643K 2 0 sem 12 0K 0K 78643K 1273 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1810 197K 290K 78643K 12817 0 file desc 7 21K 33K 78643K 2142 0 sigio 0 0K 0K 78643K 61 0 proc 48 50K 83K 78643K 2332 0 subproc 34 2K 2K 78643K 714 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 3K 78643K 3220 0 in_multi 33 2K 2K 78643K 525 0 ether_multi 1 0K 0K 78643K 5 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 156 689K 689K 78643K 156 0 exec 0 0K 1K 78643K 912 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 134 23K 31K 78643K 8780 0 UVM aobj 130 4K 4K 78643K 134 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 141 0 NDP 5 0K 0K 78643K 129 0 temp 106 3034K 3146K 78643K 12283 0 kqueue 0 0K 0K 78643K 65 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 95 0 89 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtpcb 80 396 0 394 1 0 1 1 0 8 0 rtentry 112 454 0 410 2 0 2 2 0 8 0 unpcb 120 2282 0 2273 6 5 1 2 0 8 0 syncache 264 25 0 25 11 11 0 1 0 8 0 tcpqe 32 38 0 38 8 8 0 1 0 8 0 tcpcb 544 1090 0 1084 6 5 1 2 0 8 0 ipq 40 44 0 44 7 6 1 1 0 8 1 ipqe 40 1894 0 1894 7 6 1 1 0 8 1 inpcb 280 4163 0 4153 12 9 3 4 0 8 2 ip6q 72 2 0 2 2 2 0 1 0 8 0 ip6af 40 5 0 5 2 2 0 1 0 8 0 nd6 48 84 0 80 1 0 1 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 1970 0 1754 14 0 14 14 0 8 0 art_table 32 1971 0 1754 2 0 2 2 0 8 0 art_node 16 453 0 413 1 0 1 1 0 8 0 sysvmsgpl 40 76 0 39 1 0 1 1 0 8 0 semapl 112 1271 0 1261 1 0 1 1 0 8 0 shmpl 112 132 0 4 4 0 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 3777 0 2370 46 0 46 46 0 8 0 ffsino 272 3777 0 2370 96 1 95 95 0 8 0 nchpl 144 7343 0 5733 60 0 60 60 0 8 0 uvmvnodes 72 4500 0 0 82 0 82 82 0 8 0 vnodes 208 4500 0 0 237 0 237 237 0 8 0 namei 1024 31417 0 31417 1 0 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scxspl 192 20952 0 20952 24 21 3 4 0 8 3 plimitpl 152 709 0 700 1 0 1 1 0 8 0 sigapl 432 2193 0 2178 6 4 2 3 0 8 0 futexpl 56 52772 0 52772 1 0 1 1 0 8 1 knotepl 112 1031 0 1012 3 2 1 2 0 8 0 kqueuepl 104 1284 0 1282 3 2 1 3 0 8 0 pipepl 160 3352 0 3333 5 3 2 2 0 8 1 fdescpl 488 2194 0 2178 3 0 3 3 0 8 0 filepl 152 25772 0 25673 27 19 8 12 0 8 4 lockfpl 104 930 0 929 1 0 1 1 0 8 0 lockfspl 48 356 0 355 1 0 1 1 0 8 0 sessionpl 112 57 0 47 1 0 1 1 0 8 0 pgrppl 48 97 0 87 1 0 1 1 0 8 0 ucredpl 96 5335 0 5326 1 0 1 1 0 8 0 zombiepl 144 2178 0 2178 1 0 1 1 0 8 1 processpl 904 2211 0 2178 6 2 4 5 0 8 0 procpl 632 6226 0 6183 6 1 5 5 0 8 1 srpgc 64 80 0 80 10 9 1 1 0 8 1 sosppl 128 73 0 73 10 9 1 1 0 8 1 sockpl 384 6923 0 6902 29 22 7 8 0 8 4 mcl64k 65536 27 0 0 3 0 3 3 0 8 0 mcl16k 16384 17 0 0 3 0 3 3 0 8 0 mcl12k 12288 19 0 0 2 0 2 2 0 8 0 mcl9k 9216 9 0 0 1 0 1 1 0 8 0 mcl8k 8192 17 0 0 3 0 3 3 0 8 1 mcl4k 4096 19 0 0 3 0 3 3 0 8 0 mcl2k2 2112 6 0 0 1 0 1 1 0 8 0 mcl2k 2048 157 0 0 19 2 17 19 0 8 0 mtagpl 80 1 0 0 1 0 1 1 0 8 0 mbufpl 256 487 0 0 22 0 22 22 0 8 0 bufpl 280 11770 0 4704 505 0 505 505 0 8 0 anonpl 16 341093 0 327135 136 71 65 81 0 125 0 amapchunkpl 152 20787 0 20662 41 33 8 13 0 158 0 amappl16 192 12611 0 11729 136 90 46 56 0 8 1 amappl15 184 469 0 466 1 0 1 1 0 8 0 amappl14 176 571 0 564 1 0 1 1 0 8 0 amappl13 168 199 0 198 1 0 1 1 0 8 0 amappl12 160 170 0 165 1 0 1 1 0 8 0 amappl11 152 238 0 227 1 0 1 1 0 8 0 amappl10 144 295 0 290 1 0 1 1 0 8 0 amappl9 136 1349 0 1346 1 0 1 1 0 8 0 amappl8 128 721 0 675 2 0 2 2 0 8 0 amappl7 120 588 0 573 1 0 1 1 0 8 0 amappl6 112 186 0 175 1 0 1 1 0 8 0 amappl5 104 617 0 606 1 0 1 1 0 8 0 amappl4 96 2478 0 2449 1 0 1 1 0 8 0 amappl3 88 487 0 479 1 0 1 1 0 8 0 amappl2 80 14020 0 13950 3 1 2 3 0 8 0 amappl1 72 67743 0 67297 24 14 10 20 0 8 0 amappl 80 7160 0 7117 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 133 0 4 3 0 3 3 0 8 0 uaddrrnd 24 2194 0 2178 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 2194 0 2178 1 0 1 1 0 8 0 vmmpekpl 168 27224 0 27193 2 0 2 2 0 8 0 vmmpepl 168 312631 0 310483 174 48 126 130 0 357 27 vmsppl 368 2193 0 2178 2 0 2 2 0 8 0 pdppl 4096 4395 0 4356 6 0 6 6 0 8 0 pvpl 32 887788 0 870061 266 110 156 198 0 265 2 pmappl 232 2193 0 2178 6 5 1 2 0 8 0 extentpl 40 50 0 32 1 0 1 1 0 8 0 phpool 112 191 0 12 6 0 6 6 0 8 0