witness: lock order reversal: 1st 0xfffffd807f004018 vmmaplk (&map->lock) 2nd 0xfffffd806e3de700 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(fffffd806e3de700,9,0) at witness_checkorder+0x1009 witness_debugger sys/kern/subr_witness.c:2504 [inline] witness_checkorder(fffffd806e3de700,9,0) at witness_checkorder+0x1009 sys/kern/subr_witness.c:1086 rw_enter(fffffd806e3de6f0,81) at rw_enter+0xd4 rrw_enter(fffffd806e3de6f0,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:453 VOP_LOCK(fffffd8066e474e8,81) at VOP_LOCK+0xf9 sys/kern/vfs_vops.c:615 vn_lock(fffffd8066e474e8,81) at vn_lock+0x81 sys/kern/vfs_vnops.c:571 uvn_io(fffffd8067fa2138,ffff800024f92b28,1,2,0) at uvn_io+0x2c8 sys/uvm/uvm_vnode.c:1189 uvn_get(fffffd8067fa2138,0,ffff800024f92d80,ffff800024f92d14,0,0) at uvn_get+0x226 sys/uvm/uvm_vnode.c:1049 uvm_fault(fffffd807f004000,20002000,2,2) at uvm_fault+0x11cc sys/uvm/uvm_fault.c:1023 uvm_fault_wire(fffffd807f004000,20002000,20005000,2) at uvm_fault_wire+0x70 sys/uvm/uvm_fault.c:1295 uvm_map_pageable_wire(fffffd807f004000,fffffd806b3ae580,fffffd806b3aeac0,ffff800020d4c000,0,0) at uvm_map_pageable_wire+0x2dd sys/uvm/uvm_map.c:2358 sys_mlock(ffff800020a98018,ffff800024f92f78,ffff800024f92fc0) at sys_mlock+0x185 sys/uvm/uvm_mmap.c:765 syscall(ffff800024f93040) at syscall+0x4a4 mi_syscall sys/sys/syscall_mi.h:92 [inline] syscall(ffff800024f93040) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:555 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x5819f816f20, count: -14 ddb{1}> show registers rdi 0x3 rsi 0x3ffff acpi_pdirpa+0x2be67 rbp 0xffff800024f927a0 rbx 0x3 rdx 0x40000 acpi_pdirpa+0x2be68 rcx 0xffff800020d4c000 rax 0xffff8000009e6d40 r8 0xffffffff81b6af72 witness_checkorder+0xfe2 r9 0x5 r10 0x3 r11 0xab2b886051f7f00f r12 0xfffffd800297b100 r13 0 r14 0xffffffff825edff0 w_lodata+0x47280 r15 0xffffffff825fbe00 w_lodata+0x55090 rip 0xffffffff819657f8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800024f92790 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{1}> show proc PROC (syz-executor.1) pid=389808 stat=onproc flags process=10 proc=4000000 pri=86, usrpri=86, nice=20 forw=0xffffffffffffffff, list=0xffff800020a98780,0xffffffff82659068 process=0xffff800020aec728 user=0xffff800024f8e000, vmspace=0xfffffd807f004000 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND 50802 247376 21925 32767 7 0x10 syz-executor.1 50802 334546 21925 32767 3 0x4000090 ttyout syz-executor.1 *50802 389808 21925 32767 7 0x4000010 syz-executor.1 21925 401645 21976 32767 3 0x90 nanosleep syz-executor.1 21976 450133 31944 0 3 0x82 wait syz-executor.1 24876 480831 0 0 3 0x14200 bored sosplice 31944 186662 57335 0 3 0x82 thrsleep syz-fuzzer 31944 242163 57335 0 3 0x4000082 nanosleep syz-fuzzer 31944 433321 57335 0 3 0x4000082 thrsleep syz-fuzzer 31944 503734 57335 0 3 0x4000082 thrsleep syz-fuzzer 31944 494438 57335 0 3 0x4000082 thrsleep syz-fuzzer 31944 480378 57335 0 3 0x4000082 kqread syz-fuzzer 31944 44086 57335 0 3 0x4000002 biowait syz-fuzzer 31944 380082 57335 0 3 0x4000082 thrsleep syz-fuzzer 31944 515097 57335 0 3 0x4000082 thrsleep syz-fuzzer 31944 441919 57335 0 3 0x4000082 thrsleep syz-fuzzer 57335 257031 19200 0 3 0x10008a pause ksh 19200 104311 99822 0 3 0x92 select sshd 29341 457486 1 0 3 0x100083 ttyin getty 99822 202375 1 0 3 0x80 select sshd 22817 520740 44853 73 3 0x100090 kqread syslogd 44853 430909 1 0 3 0x100082 netio syslogd 19052 60143 1 77 3 0x100090 poll dhclient 79135 474660 1 0 3 0x80 poll dhclient 273 208721 0 0 3 0x14200 pgzero zerothread 96039 135099 0 0 3 0x14200 aiodoned aiodoned 35523 459474 0 0 3 0x14200 syncer update 19129 20311 0 0 3 0x14200 cleaner cleaner 10081 217263 0 0 3 0x14200 reaper reaper 1077 494404 0 0 3 0x14200 pgdaemon pagedaemon 37487 508912 0 0 3 0x14200 bored crynlk 30988 430315 0 0 3 0x14200 bored crypto 81593 93374 0 0 3 0x14200 bored viomb 11147 407567 0 0 3 0x40014200 acpi0 acpi0 75404 17346 0 0 3 0x40014200 idle1 11516 460206 0 0 3 0x14200 bored softnet 33828 324162 0 0 3 0x14200 bored systqmp 47451 298286 0 0 3 0x14200 bored systq 32268 229327 0 0 3 0x40014200 bored softclock 30532 173708 0 0 3 0x40014200 idle0 91802 100887 0 0 3 0x14200 bored smr 1 293071 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{1}> show all locks Process 50802 (syz-executor.1) thread 0xffff800020a98018 (389808) shared rwlock vmmaplk r = 0 (0xfffffd807f004018) #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 Process 31944 (syz-fuzzer) thread 0xffff800020a6eed8 (44086) exclusive rrwlock inode r = 0 (0xfffffd8064744c50) #0 witness_lock+0x52e sys/kern/subr_witness.c:1163 #1 rw_enter+0x453 sys/kern/kern_rwlock.c:309 #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 vget+0x1c8 sys/kern/vfs_subr.c:672 #6 ufs_ihashget+0x141 sys/ufs/ufs/ufs_ihash.c:119 #7 ffs_vget+0x74 sys/ufs/ffs/ffs_vfsops.c:1323 #8 ufs_lookup+0x14b4 sys/ufs/ufs/ufs_lookup.c:487 #9 VOP_LOOKUP+0x5b sys/kern/vfs_vops.c:91 #10 vfs_lookup+0x7a6 sys/kern/vfs_lookup.c:568 #11 namei+0x63c sys/kern/vfs_lookup.c:249 #12 dounlinkat+0x99 sys/kern/vfs_syscalls.c:1776 #13 syscall+0x4a4 mi_syscall sys/sys/syscall_mi.h:92 [inline] #13 syscall+0x4a4 sys/arch/amd64/amd64/trap.c:555 #14 Xsyscall+0x128 exclusive rrwlock inode r = 0 (0xfffffd80647440a0) #0 witness_lock+0x52e sys/kern/subr_witness.c:1163 #1 rw_enter+0x453 sys/kern/kern_rwlock.c:309 #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 vfs_lookup+0xe6 sys/kern/vfs_lookup.c:419 #6 namei+0x63c sys/kern/vfs_lookup.c:249 #7 dounlinkat+0x99 sys/kern/vfs_syscalls.c:1776 #8 syscall+0x4a4 mi_syscall sys/sys/syscall_mi.h:92 [inline] #8 syscall+0x4a4 sys/arch/amd64/amd64/trap.c:555 #9 Xsyscall+0x128 ddb{1}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 9491 6341K 6343K 78643K 10790 0 pcb 13 10K 12K 78643K 15 0 rtable 85 2K 3K 78643K 2406 0 ifaddr 32 9K 10K 78643K 404 0 counters 39 33K 33K 78643K 39 0 ioctlops 0 0K 2K 78643K 114 0 iov 0 0K 64K 78643K 583 0 mount 1 1K 1K 78643K 1 0 vnodes 1215 76K 76K 78643K 2508 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 0K 1K 78643K 1805 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1810 197K 290K 78643K 12817 0 file desc 5 13K 33K 78643K 2724 0 sigio 0 0K 0K 78643K 75 0 proc 48 50K 83K 78643K 2906 0 subproc 17 1K 2K 78643K 901 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 1K 78643K 1738 0 in_multi 22 1K 2K 78643K 667 0 ether_multi 1 0K 0K 78643K 6 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 1108 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 145 24K 33K 78643K 11079 0 UVM aobj 130 6K 6K 78643K 139 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 263 0 NDP 4 0K 0K 78643K 162 0 temp 85 3032K 3116K 78643K 15238 0 kqueue 0 0K 0K 78643K 73 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 117 0 113 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtpcb 80 677 0 675 1 0 1 1 0 8 0 rtentry 112 564 0 530 2 0 2 2 0 8 0 unpcb 120 3080 0 3070 8 7 1 2 0 8 0 syncache 264 34 0 34 15 15 0 1 0 8 0 sackhl 24 5 0 5 3 3 0 1 0 8 0 tcpqe 32 250 0 250 10 10 0 1 0 8 0 tcpcb 544 3401 0 3396 64 63 1 14 0 8 0 ipq 40 34 0 34 15 15 0 1 0 8 0 ipqe 40 1184 0 1184 15 15 0 1 0 8 0 inpcb 280 7282 0 7269 50 47 3 10 0 8 1 nd6 48 106 0 104 1 0 1 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 2482 0 2310 14 0 14 14 0 8 0 art_table 32 2483 0 2310 2 0 2 2 0 8 0 art_node 16 563 0 532 1 0 1 1 0 8 0 sysvmsgpl 40 72 0 32 1 0 1 1 0 8 0 semupl 112 3 0 3 1 1 0 1 0 8 0 semapl 112 1798 0 1788 1 0 1 1 0 8 0 shmpl 112 137 0 9 4 0 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 4344 0 2930 46 0 46 46 0 8 0 ffsino 272 4344 0 2930 95 0 95 95 0 8 0 nchpl 144 8160 0 6554 60 0 60 60 0 8 0 uvmvnodes 72 5254 0 0 96 0 96 96 0 8 0 vnodes 208 5254 0 0 277 0 277 277 0 8 0 namei 1024 35519 0 35519 7 6 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scxspl 192 24852 0 24851 40 39 1 7 0 8 0 plimitpl 152 479 0 472 1 0 1 1 0 8 0 sigapl 432 2742 0 2729 7 5 2 3 0 8 0 futexpl 56 72598 0 72598 5 4 1 1 0 8 1 knotepl 112 1620 0 1603 5 3 2 2 0 8 1 kqueuepl 104 2119 0 2117 16 15 1 4 0 8 0 pipepl 160 2300 0 2285 16 14 2 2 0 8 1 fdescpl 488 2743 0 2729 3 0 3 3 0 8 0 filepl 152 29419 0 29332 67 61 6 14 0 8 1 lockfpl 104 687 0 686 1 0 1 1 0 8 0 lockfspl 48 246 0 245 1 0 1 1 0 8 0 sessionpl 112 68 0 59 1 0 1 1 0 8 0 pgrppl 48 97 0 88 1 0 1 1 0 8 0 ucredpl 96 5635 0 5627 1 0 1 1 0 8 0 zombiepl 144 2729 0 2729 7 6 1 1 0 8 1 processpl 904 2760 0 2729 8 4 4 5 0 8 0 procpl 632 7984 0 7942 5 0 5 5 0 8 0 srpgc 64 104 0 104 18 17 1 1 0 8 1 sosppl 128 84 0 84 19 18 1 1 0 8 1 sockpl 384 11169 0 11147 88 83 5 15 0 8 2 mcl64k 65536 25 0 0 4 1 3 3 0 8 0 mcl16k 16384 19 0 0 3 0 3 3 0 8 0 mcl12k 12288 17 0 0 2 0 2 2 0 8 0 mcl9k 9216 15 0 0 2 0 2 2 0 8 0 mcl8k 8192 25 0 0 4 1 3 3 0 8 0 mcl4k 4096 17 0 0 3 0 3 3 0 8 0 mcl2k2 2112 8 0 0 1 0 1 1 0 8 0 mcl2k 2048 185 0 0 19 1 18 19 0 8 0 mtagpl 80 1 0 0 1 0 1 1 0 8 0 mbufpl 256 649 0 0 24 0 24 24 0 8 0 bufpl 280 11845 0 4779 506 1 505 506 0 8 0 anonpl 16 443653 0 427545 139 72 67 78 0 125 0 amapchunkpl 152 26565 0 26310 67 56 11 13 0 158 1 amappl16 192 15091 0 14214 167 117 50 57 0 8 2 amappl15 184 449 0 446 1 0 1 1 0 8 0 amappl14 176 682 0 678 1 0 1 1 0 8 0 amappl13 168 410 0 410 9 8 1 1 0 8 1 amappl12 160 295 0 292 2 1 1 1 0 8 0 amappl11 152 450 0 438 1 0 1 1 0 8 0 amappl10 144 365 0 358 1 0 1 1 0 8 0 amappl9 136 1340 0 1338 1 0 1 1 0 8 0 amappl8 128 764 0 705 3 0 3 3 0 8 0 amappl7 120 683 0 667 1 0 1 1 0 8 0 amappl6 112 345 0 336 1 0 1 1 0 8 0 amappl5 104 896 0 887 1 0 1 1 0 8 0 amappl4 96 3106 0 3075 1 0 1 1 0 8 0 amappl3 88 507 0 497 1 0 1 1 0 8 0 amappl2 80 17728 0 17658 3 1 2 3 0 8 0 amappl1 72 84904 0 84468 24 14 10 20 0 8 0 amappl 80 9105 0 9063 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 138 0 9 3 0 3 3 0 8 0 uaddrrnd 24 2743 0 2729 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 2743 0 2729 1 0 1 1 0 8 0 vmmpekpl 168 28873 0 28843 2 0 2 2 0 8 0 vmmpepl 168 392887 0 390851 288 156 132 143 0 357 30 vmsppl 368 2742 0 2729 2 0 2 2 0 8 0 pdppl 4096 5493 0 5458 6 0 6 6 0 8 0 pvpl 32 1199254 0 1180142 325 161 164 186 0 265 4 pmappl 232 2742 0 2729 11 10 1 2 0 8 0 extentpl 40 50 0 32 1 0 1 1 0 8 0 phpool 112 260 0 78 7 1 6 6 0 8 0