witness: lock order reversal: 1st 0xfffffd806e8a4190 vmmaplk (&map->lock) 2nd 0xfffffd80647bac48 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(fffffd80647bac48,9,0) at witness_checkorder+0x1009 witness_debugger sys/kern/subr_witness.c:2504 [inline] witness_checkorder(fffffd80647bac48,9,0) at witness_checkorder+0x1009 sys/kern/subr_witness.c:1086 rw_enter(fffffd80647bac38,81) at rw_enter+0xd4 rrw_enter(fffffd80647bac38,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:453 VOP_LOCK(fffffd80634958f8,81) at VOP_LOCK+0xf9 sys/kern/vfs_vops.c:615 vn_lock(fffffd80634958f8,81) at vn_lock+0x81 sys/kern/vfs_vnops.c:571 uvn_io(fffffd8066f5fb90,ffff800024f8b638,1,2,0) at uvn_io+0x2c8 sys/uvm/uvm_vnode.c:1189 uvn_get(fffffd8066f5fb90,0,ffff800024f8b890,ffff800024f8b824,0,4) at uvn_get+0x226 sys/uvm/uvm_vnode.c:1049 uvm_fault(fffffd806e8a4178,20002000,2,4) at uvm_fault+0x11cc sys/uvm/uvm_fault.c:1023 uvm_fault_wire(fffffd806e8a4178,20002000,20003000,4) at uvm_fault_wire+0x70 sys/uvm/uvm_fault.c:1295 uvm_map_pageable_wire(fffffd806e8a4178,fffffd8079112a28,fffffd806b3abb40,ffff800020d48000,0,0) at uvm_map_pageable_wire+0x2dd sys/uvm/uvm_map.c:2358 sys_mlock(ffff800020a98780,ffff800024f8ba88,ffff800024f8bad0) at sys_mlock+0x185 sys/uvm/uvm_mmap.c:765 syscall(ffff800024f8bb50) at syscall+0x4a4 mi_syscall sys/sys/syscall_mi.h:92 [inline] syscall(ffff800024f8bb50) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:555 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x303709d33a0, count: -14 ddb{0}> show registers rdi 0x3 rsi 0x3ffff acpi_pdirpa+0x2be67 rbp 0xffff800024f8b2b0 rbx 0x3 rdx 0x40000 acpi_pdirpa+0x2be68 rcx 0xffff800020d48000 rax 0xffff800000a3b200 r8 0xffffffff81b6af72 witness_checkorder+0xfe2 r9 0x5 r10 0x3 r11 0x4ab3f9edb58ccac5 r12 0xfffffd800297b100 r13 0 r14 0xffffffff825f09e0 w_lodata+0x49c70 r15 0xffffffff825fbd50 w_lodata+0x54fe0 rip 0xffffffff819657f8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800024f8b2a0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.0) pid=33951 stat=onproc flags process=10 proc=4000000 pri=86, usrpri=86, nice=20 forw=0xffffffffffffffff, list=0xffff800020a99b40,0xffff800020a98ef8 process=0xffff800020aa2728 user=0xffff800024f86000, vmspace=0xfffffd806e8a4178 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 60778 141235 62128 0 7 0x100002 sh 62128 509725 51440 0 3 0x80 wait syz-executor.1 51440 445209 68834 0 3 0x82 wait syz-executor.1 34224 231924 28718 32767 2 0x10 syz-executor.0 34224 66294 28718 32767 3 0x4000090 nanosleep syz-executor.0 *34224 33951 28718 32767 7 0x4000010 syz-executor.0 28718 478126 40770 32767 3 0x90 nanosleep syz-executor.0 40770 222121 68834 0 3 0x82 wait syz-executor.0 2090 477628 0 0 3 0x14200 bored sosplice 68834 243733 85097 0 3 0x82 thrsleep syz-fuzzer 68834 304131 85097 0 3 0x4000082 thrsleep syz-fuzzer 68834 40350 85097 0 3 0x4000082 thrsleep syz-fuzzer 68834 476121 85097 0 3 0x4000082 thrsleep syz-fuzzer 68834 4708 85097 0 3 0x4000082 kqread syz-fuzzer 68834 122454 85097 0 3 0x4000082 thrsleep syz-fuzzer 68834 201931 85097 0 3 0x4000082 thrsleep syz-fuzzer 68834 99503 85097 0 3 0x4000082 thrsleep syz-fuzzer 68834 365085 85097 0 3 0x4000082 thrsleep syz-fuzzer 68834 266538 85097 0 3 0x4000082 thrsleep syz-fuzzer 85097 186999 51619 0 3 0x10008a pause ksh 51619 249072 64046 0 3 0x92 select sshd 4539 357330 1 0 3 0x100083 ttyin getty 64046 4783 1 0 3 0x80 select sshd 97932 467703 45762 73 3 0x100090 kqread syslogd 45762 289014 1 0 3 0x100082 netio syslogd 1414 311602 1 77 3 0x100090 poll dhclient 85273 417136 1 0 3 0x80 poll dhclient 40092 50524 0 0 2 0x14200 zerothread 53801 168217 0 0 3 0x14200 aiodoned aiodoned 790 145740 0 0 3 0x14200 syncer update 7365 414538 0 0 3 0x14200 cleaner cleaner 42263 220380 0 0 3 0x14200 reaper reaper 28971 57629 0 0 3 0x14200 pgdaemon pagedaemon 97716 439426 0 0 3 0x14200 bored crynlk 3350 21169 0 0 3 0x14200 bored crypto 21725 368073 0 0 3 0x14200 bored viomb 47305 491972 0 0 3 0x40014200 acpi0 acpi0 58224 304868 0 0 3 0x40014200 idle1 543 288204 0 0 3 0x14200 bored softnet 47301 34452 0 0 3 0x14200 bored systqmp 90030 448366 0 0 3 0x14200 bored systq 25147 282779 0 0 3 0x40014200 bored softclock 34979 350475 0 0 3 0x40014200 idle0 26383 438300 0 0 3 0x14200 bored smr 1 249658 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 34224 (syz-executor.0) thread 0xffff800020a98780 (33951) shared rwlock vmmaplk r = 0 (0xfffffd806e8a4190) #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 9481 6341K 6341K 78643K 10627 0 pcb 13 8K 8K 78643K 13 0 rtable 91 2K 3K 78643K 763 0 ifaddr 37 9K 10K 78643K 141 0 counters 39 33K 33K 78643K 39 0 ioctlops 0 0K 2K 78643K 34 0 iov 0 0K 16K 78643K 112 0 mount 1 1K 1K 78643K 1 0 vnodes 1215 76K 76K 78643K 1515 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 5K 78643K 11 0 VM map 2 1K 1K 78643K 2 0 sem 12 0K 0K 78643K 310 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1810 197K 290K 78643K 12817 0 file desc 8 25K 33K 78643K 580 0 sigio 0 0K 0K 78643K 22 0 proc 48 50K 83K 78643K 964 0 subproc 34 2K 2K 78643K 272 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 0K 78643K 91 0 in_multi 23 1K 2K 78643K 194 0 ether_multi 1 0K 0K 78643K 3 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 72 318K 318K 78643K 72 0 exec 0 0K 1K 78643K 410 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 123 31K 31K 78643K 2919 0 UVM aobj 53 2K 2K 78643K 60 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 51 0 NDP 7 0K 0K 78643K 49 0 temp 105 3030K 3096K 78643K 5896 0 kqueue 0 0K 0K 78643K 11 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 35 0 30 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtpcb 80 111 0 109 1 0 1 1 0 8 0 rtentry 112 180 0 143 2 0 2 2 0 8 0 unpcb 120 553 0 544 2 1 1 2 0 8 0 syncache 264 5 0 5 3 3 0 1 0 8 0 sackhl 24 1 0 1 1 1 0 1 0 8 0 tcpqe 32 76 0 76 1 1 0 1 0 8 0 tcpcb 544 214 0 209 1 0 1 1 0 8 0 ipq 40 11 0 11 3 2 1 1 0 8 1 ipqe 40 457 0 457 3 2 1 1 0 8 1 inpcb 280 662 0 654 3 1 2 2 0 8 1 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 30 0 28 1 0 1 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 799 0 624 14 0 14 14 0 8 3 art_table 32 800 0 624 2 0 2 2 0 8 0 art_node 16 179 0 145 1 0 1 1 0 8 0 sysvmsgpl 40 50 0 25 1 0 1 1 0 8 0 semapl 112 308 0 298 1 0 1 1 0 8 0 shmpl 112 58 0 7 2 0 2 2 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 2024 0 622 46 0 46 46 0 8 0 ffsino 272 2024 0 622 94 0 94 94 0 8 0 nchpl 144 2960 0 1358 60 0 60 60 0 8 0 uvmvnodes 72 2305 0 0 42 0 42 42 0 8 0 vnodes 208 2305 0 0 122 0 122 122 0 8 0 namei 1024 11366 0 11366 1 0 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scxspl 192 9430 0 9430 11 9 2 7 0 8 2 plimitpl 152 110 0 101 1 0 1 1 0 8 0 sigapl 432 709 0 693 3 1 2 3 0 8 0 futexpl 56 14316 0 14316 1 0 1 1 0 8 1 knotepl 112 325 0 304 2 1 1 2 0 8 0 kqueuepl 104 301 0 299 1 0 1 1 0 8 0 pipepl 160 750 0 731 4 2 2 2 0 8 1 fdescpl 488 710 0 693 3 0 3 3 0 8 0 filepl 152 6885 0 6782 10 5 5 7 0 8 0 lockfpl 104 254 0 253 1 0 1 1 0 8 0 lockfspl 48 107 0 106 1 0 1 1 0 8 0 sessionpl 112 31 0 21 1 0 1 1 0 8 0 pgrppl 48 40 0 30 1 0 1 1 0 8 0 ucredpl 96 931 0 923 1 0 1 1 0 8 0 zombiepl 144 693 0 693 1 0 1 1 0 8 1 processpl 904 727 0 693 4 0 4 4 0 8 0 procpl 632 1609 0 1564 5 0 5 5 0 8 1 srpgc 64 28 0 28 2 1 1 1 0 8 1 sosppl 128 3 0 3 1 1 0 1 0 8 0 sockpl 384 1341 0 1322 12 7 5 7 0 8 2 mcl64k 65536 18 0 0 3 0 3 3 0 8 0 mcl16k 16384 6 0 0 1 0 1 1 0 8 0 mcl12k 12288 12 0 0 2 0 2 2 0 8 0 mcl9k 9216 4 0 0 1 0 1 1 0 8 0 mcl8k 8192 15 0 0 2 0 2 2 0 8 0 mcl4k 4096 6 0 0 1 0 1 1 0 8 0 mcl2k2 2112 3 0 0 1 0 1 1 0 8 0 mcl2k 2048 217 0 0 26 1 25 26 0 8 0 mtagpl 80 1 0 0 1 0 1 1 0 8 0 mbufpl 256 394 0 0 23 0 23 23 0 8 0 bufpl 280 7479 0 1330 440 0 440 440 0 8 0 anonpl 16 99138 0 85237 78 14 64 75 0 125 1 amapchunkpl 152 6015 0 5746 12 1 11 11 0 158 0 amappl16 192 2997 0 2146 57 12 45 53 0 8 0 amappl15 184 183 0 180 1 0 1 1 0 8 0 amappl14 176 146 0 141 1 0 1 1 0 8 0 amappl13 168 16 0 15 1 0 1 1 0 8 0 amappl12 160 79 0 74 1 0 1 1 0 8 0 amappl11 152 150 0 138 1 0 1 1 0 8 0 amappl10 144 75 0 67 1 0 1 1 0 8 0 amappl9 136 804 0 801 1 0 1 1 0 8 0 amappl8 128 309 0 278 2 0 2 2 0 8 0 amappl7 120 239 0 222 1 0 1 1 0 8 0 amappl6 112 131 0 122 1 0 1 1 0 8 0 amappl5 104 329 0 319 1 0 1 1 0 8 0 amappl4 96 960 0 926 1 0 1 1 0 8 0 amappl3 88 177 0 168 1 0 1 1 0 8 0 amappl2 80 3929 0 3858 3 1 2 3 0 8 0 amappl1 72 27617 0 27165 24 14 10 20 0 8 0 amappl 80 2063 0 2018 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 59 0 7 1 0 1 1 0 8 0 uaddrrnd 24 710 0 693 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 710 0 693 1 0 1 1 0 8 0 vmmpekpl 168 10312 0 10285 2 0 2 2 0 8 0 vmmpepl 168 105010 0 102884 139 12 127 127 0 357 33 vmsppl 368 709 0 693 2 0 2 2 0 8 0 pdppl 4096 1427 0 1386 6 0 6 6 0 8 0 pvpl 32 299460 0 281680 189 29 160 183 0 265 7 pmappl 232 709 0 693 5 3 2 2 0 8 0 extentpl 40 50 0 32 1 0 1 1 0 8 0 phpool 112 185 0 3 6 0 6 6 0 8 0