witness: lock order reversal: 1st 0xfffffd807f004d08 vmmaplk (&map->lock) 2nd 0xfffffd806e402098 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(fffffd806e402098,9,0) at witness_checkorder+0x1009 witness_debugger sys/kern/subr_witness.c:2504 [inline] witness_checkorder(fffffd806e402098,9,0) at witness_checkorder+0x1009 sys/kern/subr_witness.c:1086 rw_enter(fffffd806e402088,81) at rw_enter+0xd4 rrw_enter(fffffd806e402088,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:453 VOP_LOCK(fffffd807d621908,81) at VOP_LOCK+0xf9 sys/kern/vfs_vops.c:615 vn_lock(fffffd807d621908,81) at vn_lock+0x81 sys/kern/vfs_vnops.c:571 uvn_io(fffffd8066f1f3b8,ffff800024fcb8f8,1,2,0) at uvn_io+0x2c8 sys/uvm/uvm_vnode.c:1189 uvn_get(fffffd8066f1f3b8,0,ffff800024fcbb50,ffff800024fcbae4,0,0) at uvn_get+0x226 sys/uvm/uvm_vnode.c:1049 uvm_fault(fffffd807f004cf0,20002000,2,2) at uvm_fault+0x11cc sys/uvm/uvm_fault.c:1023 uvm_fault_wire(fffffd807f004cf0,20002000,20005000,2) at uvm_fault_wire+0x70 sys/uvm/uvm_fault.c:1295 uvm_map_pageable_wire(fffffd807f004cf0,fffffd806635fb80,fffffd806635f100,ffff800020d58000,0,0) at uvm_map_pageable_wire+0x2dd sys/uvm/uvm_map.c:2358 sys_mlock(ffff800020a98508,ffff800024fcbd48,ffff800024fcbd90) at sys_mlock+0x185 sys/uvm/uvm_mmap.c:765 syscall(ffff800024fcbe10) at syscall+0x4a4 mi_syscall sys/sys/syscall_mi.h:92 [inline] syscall(ffff800024fcbe10) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:555 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xc4ec8f7bb0, count: -14 ddb{1}> show registers rdi 0x3 rsi 0x3ffff acpi_pdirpa+0x2be67 rbp 0xffff800024fcb570 rbx 0x3 rdx 0x40000 acpi_pdirpa+0x2be68 rcx 0xffff800020d58000 rax 0xffff8000009e6ec0 r8 0xffffffff81b6af72 witness_checkorder+0xfe2 r9 0x5 r10 0x3 r11 0x54fd1c71f4dfdd44 r12 0xfffffd800297b100 r13 0 r14 0xffffffff825ec3c0 w_lodata+0x45650 r15 0xffffffff825fbd50 w_lodata+0x54fe0 rip 0xffffffff819657f8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800024fcb560 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{1}> show proc PROC (syz-executor.1) pid=429027 stat=onproc flags process=10 proc=4000000 pri=86, usrpri=86, nice=20 forw=0xffffffffffffffff, list=0xffff800020a98018,0xffffffff82659068 process=0xffff800020a9bc50 user=0xffff800024fc6000, vmspace=0xfffffd807f004cf0 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND 78611 287015 62687 32767 7 0x10 syz-executor.1 78611 13480 62687 32767 3 0x4000090 ttyout syz-executor.1 *78611 429027 62687 32767 7 0x4000010 syz-executor.1 62687 303343 17106 32767 3 0x90 nanosleep syz-executor.1 17106 424171 2311 0 3 0x82 wait syz-executor.1 31636 38169 0 0 3 0x14200 bored sosplice 2311 236915 71529 0 3 0x82 thrsleep syz-fuzzer 2311 446652 71529 0 3 0x4000082 nanosleep syz-fuzzer 2311 164972 71529 0 3 0x4000082 thrsleep syz-fuzzer 2311 163621 71529 0 3 0x4000082 thrsleep syz-fuzzer 2311 248398 71529 0 3 0x4000082 thrsleep syz-fuzzer 2311 174067 71529 0 3 0x4000082 thrsleep syz-fuzzer 2311 129310 71529 0 3 0x4000082 thrsleep syz-fuzzer 2311 474355 71529 0 3 0x4000082 thrsleep syz-fuzzer 2311 63161 71529 0 3 0x4000082 thrsleep syz-fuzzer 2311 214779 71529 0 3 0x4000082 kqread syz-fuzzer 71529 447341 67859 0 3 0x10008a pause ksh 67859 98487 443 0 3 0x92 select sshd 89889 1609 1 0 3 0x100083 ttyin getty 443 347288 1 0 3 0x80 select sshd 40517 384312 79454 73 3 0x100090 kqread syslogd 79454 43727 1 0 3 0x100082 netio syslogd 39169 21161 1 77 3 0x100090 poll dhclient 82439 67203 1 0 3 0x80 poll dhclient 87633 256477 0 0 3 0x14200 pgzero zerothread 20916 117319 0 0 3 0x14200 aiodoned aiodoned 17978 518817 0 0 3 0x14200 syncer update 87379 309748 0 0 3 0x14200 cleaner cleaner 39029 95610 0 0 3 0x14200 reaper reaper 7108 423101 0 0 3 0x14200 pgdaemon pagedaemon 77704 99437 0 0 3 0x14200 bored crynlk 23477 127206 0 0 3 0x14200 bored crypto 45794 407310 0 0 3 0x14200 bored viomb 180 492785 0 0 3 0x40014200 acpi0 acpi0 79602 71312 0 0 3 0x40014200 idle1 64844 396401 0 0 3 0x14200 bored softnet 86129 440409 0 0 3 0x14200 bored systqmp 75648 249143 0 0 3 0x14200 bored systq 98935 246121 0 0 3 0x40014200 bored softclock 97495 40285 0 0 3 0x40014200 idle0 4304 179048 0 0 3 0x14200 bored smr 1 382616 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{1}> show all locks Process 78611 (syz-executor.1) thread 0xffff800020a98508 (429027) shared rwlock vmmaplk r = 0 (0xfffffd807f004d08) #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{1}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 9492 6341K 6343K 78643K 10927 0 pcb 13 10K 12K 78643K 15 0 rtable 85 2K 3K 78643K 3826 0 ifaddr 32 10K 12K 78643K 650 0 counters 39 33K 33K 78643K 39 0 ioctlops 0 0K 2K 78643K 192 0 iov 0 0K 48K 78643K 649 0 mount 1 1K 1K 78643K 1 0 vnodes 1215 76K 76K 78643K 3165 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 9K 78643K 59 0 VM map 2 1K 1K 78643K 2 0 sem 12 0K 1K 78643K 2017 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1810 197K 290K 78643K 12817 0 file desc 5 13K 33K 78643K 3648 0 sigio 0 0K 0K 78643K 159 0 proc 48 50K 83K 78643K 4472 0 subproc 17 1K 2K 78643K 1479 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 1K 78643K 3181 0 in_multi 22 1K 2K 78643K 1081 0 ether_multi 1 0K 0K 78643K 14 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 162 715K 715K 78643K 162 0 exec 0 0K 1K 78643K 1703 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 24K 39K 78643K 14393 0 UVM aobj 130 4K 4K 78643K 135 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 298 0 NDP 4 0K 0K 78643K 264 0 temp 85 3032K 3112K 78643K 20519 0 kqueue 0 0K 0K 78643K 67 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 187 0 183 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtpcb 80 697 0 695 1 0 1 1 0 8 0 rtentry 112 906 0 872 2 0 2 2 0 8 0 unpcb 120 3899 0 3887 16 15 1 2 0 8 0 syncache 264 41 0 41 13 12 1 1 0 8 1 sackhl 24 1 0 1 1 1 0 1 0 8 0 tcpqe 32 342 0 342 9 8 1 1 0 8 1 tcpcb 544 5561 0 5555 53 51 2 13 0 8 1 ipq 40 68 0 68 13 12 1 1 0 8 1 ipqe 40 2460 0 2460 13 12 1 1 0 8 1 inpcb 280 8840 0 8828 46 43 3 10 0 8 1 ip6q 72 7 0 7 6 6 0 1 0 8 0 ip6af 40 194 0 194 6 6 0 1 0 8 0 nd6 48 174 0 172 1 0 1 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 3977 0 3805 14 0 14 14 0 8 3 art_table 32 3978 0 3805 2 0 2 2 0 8 0 art_node 16 905 0 874 1 0 1 1 0 8 0 sysvmsgpl 40 76 0 46 1 0 1 1 0 8 0 semupl 112 3 0 3 1 1 0 1 0 8 0 semapl 112 2015 0 2005 1 0 1 1 0 8 0 shmpl 112 133 0 5 4 0 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 5055 0 3630 47 0 47 47 0 8 0 ffsino 272 5055 0 3630 98 2 96 96 0 8 0 nchpl 144 10889 0 9280 62 1 61 61 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 50453 0 50453 3 2 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scxspl 192 29525 0 29525 35 32 3 7 0 8 3 plimitpl 152 652 0 645 1 0 1 1 0 8 0 sigapl 432 3564 0 3551 6 4 2 3 0 8 0 futexpl 56 80653 0 80653 3 2 1 1 0 8 1 knotepl 112 1945 0 1932 8 7 1 3 0 8 0 kqueuepl 104 2628 0 2626 15 14 1 4 0 8 0 pipepl 160 3536 0 3523 12 11 1 2 0 8 0 fdescpl 488 3565 0 3551 3 0 3 3 0 8 0 filepl 152 39687 0 39605 68 62 6 14 0 8 2 lockfpl 104 1192 0 1191 1 0 1 1 0 8 0 lockfspl 48 358 0 357 1 0 1 1 0 8 0 sessionpl 112 102 0 93 1 0 1 1 0 8 0 pgrppl 48 172 0 163 1 0 1 1 0 8 0 ucredpl 96 7477 0 7469 1 0 1 1 0 8 0 zombiepl 144 3551 0 3551 2 1 1 1 0 8 1 processpl 904 3582 0 3551 7 3 4 5 0 8 0 procpl 632 9767 0 9725 7 2 5 5 0 8 1 srpgc 64 172 0 172 14 13 1 1 0 8 1 sosppl 128 88 0 88 17 16 1 1 0 8 1 sockpl 384 14029 0 14006 78 74 4 16 0 8 0 mcl64k 65536 41 0 0 3 0 3 3 0 8 0 mcl16k 16384 18 0 0 3 1 2 3 0 8 0 mcl12k 12288 25 0 0 2 0 2 2 0 8 0 mcl9k 9216 17 0 0 2 0 2 2 0 8 0 mcl8k 8192 23 0 0 3 1 2 3 0 8 0 mcl4k 4096 18 0 0 3 0 3 3 0 8 0 mcl2k2 2112 8 0 0 1 0 1 1 0 8 0 mcl2k 2048 171 0 0 19 3 16 19 0 8 0 mtagpl 80 1 0 0 1 0 1 1 0 8 0 mbufpl 256 673 0 0 23 0 23 23 0 8 0 bufpl 280 12869 0 5803 507 1 506 506 0 8 0 anonpl 16 515851 0 501830 137 69 68 81 0 125 0 amapchunkpl 152 35351 0 35099 70 59 11 19 0 158 1 amappl16 192 17551 0 16686 178 132 46 57 0 8 0 amappl15 184 644 0 635 1 0 1 1 0 8 0 amappl14 176 938 0 936 1 0 1 1 0 8 0 amappl13 168 204 0 204 11 10 1 1 0 8 1 amappl12 160 540 0 537 1 0 1 1 0 8 0 amappl11 152 695 0 684 1 0 1 1 0 8 0 amappl10 144 263 0 261 2 1 1 1 0 8 0 amappl9 136 1937 0 1934 1 0 1 1 0 8 0 amappl8 128 1124 0 1068 3 0 3 3 0 8 0 amappl7 120 824 0 808 1 0 1 1 0 8 0 amappl6 112 503 0 490 1 0 1 1 0 8 0 amappl5 104 1416 0 1407 1 0 1 1 0 8 0 amappl4 96 3808 0 3776 1 0 1 1 0 8 0 amappl3 88 891 0 883 1 0 1 1 0 8 0 amappl2 80 21431 0 21356 3 1 2 3 0 8 0 amappl1 72 108894 0 108456 24 14 10 20 0 8 0 amappl 80 11478 0 11436 3 1 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 134 0 5 3 0 3 3 0 8 0 uaddrrnd 24 3565 0 3551 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 3565 0 3551 1 0 1 1 0 8 0 vmmpekpl 168 37419 0 37396 2 0 2 2 0 8 0 vmmpepl 168 516860 0 514827 281 154 127 141 0 357 26 vmsppl 368 3564 0 3551 2 0 2 2 0 8 0 pdppl 4096 7137 0 7102 6 0 6 6 0 8 1 pvpl 32 1376472 0 1359459 351 193 158 194 0 265 0 pmappl 232 3564 0 3551 15 14 1 2 0 8 0 extentpl 40 50 0 32 1 0 1 1 0 8 0 phpool 112 244 0 65 6 0 6 6 0 8 0