witness: lock order reversal: 1st 0xfffffd807f008b98 vmmaplk (&map->lock) 2nd 0xfffffd8067438a28 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{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(fffffd8067438a28,9,0) at witness_checkorder+0x1009 witness_debugger sys/kern/subr_witness.c:2504 [inline] witness_checkorder(fffffd8067438a28,9,0) at witness_checkorder+0x1009 sys/kern/subr_witness.c:1086 rw_enter(fffffd8067438a18,81) at rw_enter+0xd4 rrw_enter(fffffd8067438a18,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:453 VOP_LOCK(fffffd8072648c48,81) at VOP_LOCK+0xf9 sys/kern/vfs_vops.c:615 vn_lock(fffffd8072648c48,81) at vn_lock+0x81 sys/kern/vfs_vnops.c:571 uvn_io(fffffd8066f6c208,ffff800022b6aec8,1,2,0) at uvn_io+0x2c8 sys/uvm/uvm_vnode.c:1189 uvn_get(fffffd8066f6c208,0,ffff800022b6b120,ffff800022b6b0b4,0,1) at uvn_get+0x226 sys/uvm/uvm_vnode.c:1049 uvm_fault(fffffd807f008b80,20002000,2,1) at uvm_fault+0x11cc sys/uvm/uvm_fault.c:1023 uvm_fault_wire(fffffd807f008b80,20002000,20004000,1) at uvm_fault_wire+0x70 sys/uvm/uvm_fault.c:1295 uvm_map_pageable_wire(fffffd807f008b80,fffffd80636d39f8,fffffd80636d3bf0,ffff800022d5a000,ffffffff818b1737,0) at uvm_map_pageable_wire+0x2dd sys/uvm/uvm_map.c:2358 sys_mlock(ffff800020a99650,ffff800022b6b318,ffff800022b6b360) at sys_mlock+0x185 sys/uvm/uvm_mmap.c:765 syscall(ffff800022b6b3e0) at syscall+0x4a4 mi_syscall sys/sys/syscall_mi.h:92 [inline] syscall(ffff800022b6b3e0) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:555 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xf54af517860, count: -14 ddb{1}> show registers rdi 0x3 rsi 0x3ffff acpi_pdirpa+0x2be67 rbp 0xffff800022b6ab40 rbx 0x3 rdx 0x40000 acpi_pdirpa+0x2be68 rcx 0xffff800022d5a000 rax 0xffff8000009f69c0 r8 0xffffffff818af532 witness_checkorder+0xfe2 r9 0x5 r10 0x3 r11 0x1348b2d5be57370 r12 0xfffffd800297c200 r13 0 r14 0xffffffff825f0760 w_lodata+0x44940 r15 0xffffffff826010c0 w_lodata+0x552a0 rip 0xffffffff811551c8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800022b6ab30 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{1}> show proc PROC (syz-executor.0) pid=495734 stat=onproc flags process=10 proc=4000000 pri=77, usrpri=77, nice=20 forw=0xffffffffffffffff, list=0xffff800020a98ee8,0xffffffff82616060 process=0xffff800020aec728 user=0xffff800022b66000, vmspace=0xfffffd807f008b80 estcpu=36, cpticks=2, pctcpu=0.0 user=0, sys=0, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND 54701 139603 98809 32767 7 0x10 syz-executor.0 *54701 495734 98809 32767 7 0x4000010 syz-executor.0 86415 327032 97579 32767 3 0x90 nanosleep syz-executor.1 86415 200888 97579 32767 3 0x4000090 lockf syz-executor.1 86415 390837 97579 32767 3 0x4000090 fsleep syz-executor.1 97579 14675 62175 32767 3 0x90 nanosleep syz-executor.1 62175 134506 7911 0 3 0x82 wait syz-executor.1 98809 308754 20684 32767 3 0x90 nanosleep syz-executor.0 20684 42287 7911 0 3 0x82 wait syz-executor.0 83031 392501 0 0 3 0x14200 bored sosplice 7911 162821 26398 0 3 0x82 thrsleep syz-fuzzer 7911 177407 26398 0 3 0x4000082 thrsleep syz-fuzzer 7911 504913 26398 0 3 0x4000082 thrsleep syz-fuzzer 7911 415469 26398 0 3 0x4000082 thrsleep syz-fuzzer 7911 14093 26398 0 3 0x4000082 thrsleep syz-fuzzer 7911 332008 26398 0 3 0x4000082 thrsleep syz-fuzzer 7911 260204 26398 0 3 0x4000082 thrsleep syz-fuzzer 7911 35830 26398 0 3 0x4000082 thrsleep syz-fuzzer 7911 131284 26398 0 3 0x4000082 kqread syz-fuzzer 7911 316976 26398 0 3 0x4000082 thrsleep syz-fuzzer 26398 325154 71281 0 3 0x10008a pause ksh 71281 30559 24729 0 3 0x92 select sshd 89051 497244 1 0 3 0x100083 ttyin getty 24729 153072 1 0 3 0x80 select sshd 71932 146560 65942 73 3 0x100090 kqread syslogd 65942 7272 1 0 3 0x100082 netio syslogd 14137 157274 1 77 3 0x100090 poll dhclient 16960 130559 1 0 3 0x80 poll dhclient 24007 16702 0 0 3 0x14200 pgzero zerothread 51047 173396 0 0 3 0x14200 aiodoned aiodoned 1915 328889 0 0 3 0x14200 syncer update 95102 502361 0 0 3 0x14200 cleaner cleaner 26604 500928 0 0 3 0x14200 reaper reaper 92873 57261 0 0 3 0x14200 pgdaemon pagedaemon 39201 52730 0 0 3 0x14200 bored crynlk 94700 33429 0 0 3 0x14200 bored crypto 86543 174546 0 0 3 0x40014200 acpi0 acpi0 89302 181630 0 0 3 0x40014200 idle1 44807 313382 0 0 3 0x14200 bored softnet 404 137804 0 0 3 0x14200 bored systqmp 68371 232285 0 0 3 0x14200 bored systq 62458 30566 0 0 3 0x40014200 bored softclock 50031 227231 0 0 3 0x40014200 idle0 65320 170054 0 0 3 0x14200 bored smr 1 338487 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{1}> show all locks Process 54701 (syz-executor.0) thread 0xffff800020a99650 (495734) shared rwlock vmmaplk r = 0 (0xfffffd807f008b98) #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 (0xffffffff82660f10) #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{1}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 9484 6334K 6334K 78643K 10908 0 pcb 13 8K 8K 78643K 13 0 rtable 105 3K 3K 78643K 3743 0 ifaddr 39 11K 12K 78643K 636 0 counters 39 33K 33K 78643K 39 0 ioctlops 0 0K 2K 78643K 171 0 iov 0 0K 48K 78643K 615 0 mount 1 1K 1K 78643K 1 0 vnodes 1215 76K 76K 78643K 3844 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 5K 78643K 60 0 VM map 2 1K 1K 78643K 2 0 sem 12 0K 0K 78643K 4327 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1809 196K 290K 78643K 12766 0 file desc 8 25K 33K 78643K 4142 0 sigio 0 0K 0K 78643K 81 0 proc 48 50K 83K 78643K 4221 0 subproc 34 2K 2K 78643K 1445 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 2K 78643K 684 0 in_multi 33 2K 2K 78643K 1041 0 ether_multi 1 0K 0K 78643K 11 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 144 636K 636K 78643K 144 0 exec 0 0K 1K 78643K 1573 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 157 33K 33K 78643K 16221 0 UVM aobj 130 4K 4K 78643K 137 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 243 0 NDP 5 0K 0K 78643K 258 0 temp 107 3036K 3113K 78643K 21286 0 kqueue 0 0K 0K 78643K 122 0 SYN cache 2 16K 16K 78643K 2 0 ddb{1}> show all pools Name Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle arp 64 184 0 178 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtpcb 80 684 0 682 1 0 1 1 0 8 0 rtentry 112 887 0 843 2 0 2 2 0 8 0 unpcb 120 5270 0 5256 12 11 1 2 0 8 0 syncache 264 35 0 35 16 16 0 1 0 8 0 sackhl 24 2 0 2 1 1 0 1 0 8 0 tcpqe 32 11 0 11 10 10 0 1 0 8 0 tcpcb 544 4695 0 4691 23 21 2 3 0 8 1 ipq 40 67 0 67 17 16 1 1 0 8 1 ipqe 40 2584 0 2584 17 16 1 1 0 8 1 inpcb 280 8385 0 8378 22 19 3 4 0 8 2 ip6q 72 1 0 1 1 1 0 1 0 8 0 ip6af 40 3 0 3 1 1 0 1 0 8 0 nd6 48 170 0 166 1 0 1 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 3917 0 3702 14 0 14 14 0 8 0 art_table 32 3918 0 3702 2 0 2 2 0 8 0 art_node 16 886 0 846 1 0 1 1 0 8 0 sysvmsgpl 40 44 0 29 1 0 1 1 0 8 0 semupl 112 4 0 4 1 1 0 1 0 8 0 semapl 112 4325 0 4315 1 0 1 1 0 8 0 shmpl 112 135 0 7 4 0 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 6183 0 4770 46 0 46 46 0 8 0 ffsino 272 6183 0 4770 97 2 95 95 0 8 0 nchpl 144 11146 0 9535 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 59508 0 59508 4 3 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scxspl 192 31650 0 31650 45 41 4 7 0 8 4 plimitpl 152 1551 0 1541 1 0 1 1 0 8 0 sigapl 432 4064 0 4048 6 4 2 3 0 8 0 futexpl 56 96993 0 96992 4 3 1 1 0 8 0 knotepl 112 2031 0 2011 11 10 1 3 0 8 0 kqueuepl 104 2073 0 2070 3 2 1 3 0 8 0 pipepl 160 2934 0 2915 24 22 2 2 0 8 1 fdescpl 488 4065 0 4048 3 0 3 3 0 8 0 filepl 152 46555 0 46451 49 43 6 11 0 8 1 lockfpl 104 8209 0 8206 1 0 1 1 0 8 0 lockfspl 48 1938 0 1936 1 0 1 1 0 8 0 sessionpl 112 100 0 90 1 0 1 1 0 8 0 pgrppl 48 153 0 143 1 0 1 1 0 8 0 ucredpl 96 16603 0 16594 1 0 1 1 0 8 0 zombiepl 144 4048 0 4048 1 0 1 1 0 8 1 processpl 904 4081 0 4048 4 0 4 4 0 8 0 procpl 632 11684 0 11639 10 5 5 5 0 8 1 srpgc 64 166 0 166 25 25 0 1 0 8 0 sosppl 128 86 0 86 14 14 0 1 0 8 0 sockpl 384 14455 0 14432 55 50 5 10 0 8 2 mcl64k 65536 25 0 0 4 1 3 3 0 8 0 mcl16k 16384 17 0 0 3 0 3 3 0 8 0 mcl12k 12288 18 0 0 2 0 2 2 0 8 0 mcl9k 9216 5 0 0 1 0 1 1 0 8 0 mcl8k 8192 27 0 0 4 1 3 3 0 8 0 mcl4k 4096 32 0 0 4 1 3 3 0 8 0 mcl2k2 2112 4 0 0 1 0 1 1 0 8 0 mcl2k 2048 182 0 0 17 2 15 17 0 8 0 mtagpl 80 1 0 0 1 0 1 1 0 8 0 mbufpl 256 833 0 0 39 2 37 39 0 8 0 bufpl 280 13424 0 6358 506 0 506 506 0 8 0 anonpl 16 560517 0 543657 146 78 68 78 0 125 0 amapchunkpl 152 39305 0 39039 89 78 11 13 0 158 0 amappl16 192 19970 0 19126 199 153 46 60 0 8 0 amappl15 184 658 0 653 1 0 1 1 0 8 0 amappl14 176 1066 0 1061 1 0 1 1 0 8 0 amappl13 168 159 0 158 1 0 1 1 0 8 0 amappl12 160 362 0 360 2 1 1 1 0 8 0 amappl11 152 482 0 471 1 0 1 1 0 8 0 amappl10 144 446 0 442 1 0 1 1 0 8 0 amappl9 136 2708 0 2704 1 0 1 1 0 8 0 amappl8 128 1913 0 1855 4 1 3 3 0 8 0 amappl7 120 962 0 946 1 0 1 1 0 8 0 amappl6 112 312 0 301 1 0 1 1 0 8 0 amappl5 104 1120 0 1111 1 0 1 1 0 8 0 amappl4 96 4251 0 4219 1 0 1 1 0 8 0 amappl3 88 991 0 978 1 0 1 1 0 8 0 amappl2 80 25651 0 25571 3 1 2 3 0 8 0 amappl1 72 118428 0 117950 24 14 10 20 0 8 0 amappl 80 13363 0 13314 2 0 2 2 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 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 136 0 7 3 0 3 3 0 8 0 uaddrrnd 24 4065 0 4048 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 4065 0 4048 1 0 1 1 0 8 0 vmmpekpl 168 41854 0 41821 2 0 2 2 0 8 0 vmmpepl 168 574276 0 572030 348 220 128 139 0 357 30 vmsppl 368 4064 0 4048 2 0 2 2 0 8 0 pdppl 4096 8137 0 8096 6 0 6 6 0 8 0 pvpl 32 1550396 0 1529155 420 248 172 188 0 265 0 pmappl 232 4064 0 4048 18 17 1 2 0 8 0 extentpl 40 46 0 29 1 0 1 1 0 8 0 phpool 112 227 0 35 6 0 6 6 0 8 0