witness: lock order reversal: 1st 0xfffffd807f004a28 vmmaplk (&map->lock) 2nd 0xfffffd806927d918 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(fffffd806927d918,9,0) at witness_checkorder+0x1009 witness_debugger sys/kern/subr_witness.c:2504 [inline] witness_checkorder(fffffd806927d918,9,0) at witness_checkorder+0x1009 sys/kern/subr_witness.c:1086 rw_enter(fffffd806927d908,81) at rw_enter+0xd4 rrw_enter(fffffd806927d908,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:453 VOP_LOCK(fffffd80728ba840,81) at VOP_LOCK+0xf9 sys/kern/vfs_vops.c:615 vn_lock(fffffd80728ba840,81) at vn_lock+0x81 sys/kern/vfs_vnops.c:571 uvn_io(fffffd80684aef40,ffff800024d77948,1,2,0) at uvn_io+0x2c8 sys/uvm/uvm_vnode.c:1189 uvn_get(fffffd80684aef40,1000,ffff800024d77ba0,ffff800024d77b34,0,0) at uvn_get+0x226 sys/uvm/uvm_vnode.c:1049 uvm_fault(fffffd807f004a10,20001000,2,2) at uvm_fault+0x11cc sys/uvm/uvm_fault.c:1023 uvm_fault_wire(fffffd807f004a10,20001000,20004000,2) at uvm_fault_wire+0x70 sys/uvm/uvm_fault.c:1295 uvm_map_pageable_wire(fffffd807f004a10,fffffd8068065d48,fffffd80680654c0,ffff800022d4e000,ffffffff81b6d177,0) at uvm_map_pageable_wire+0x2dd sys/uvm/uvm_map.c:2358 sys_mlock(ffff800020a98018,ffff800024d77d98,ffff800024d77de0) at sys_mlock+0x185 sys/uvm/uvm_mmap.c:765 syscall(ffff800024d77e60) at syscall+0x4a4 mi_syscall sys/sys/syscall_mi.h:92 [inline] syscall(ffff800024d77e60) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:555 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x5df6d2ba980, count: -14 ddb{0}> show registers rdi 0x3 rsi 0x3ffff acpi_pdirpa+0x2be67 rbp 0xffff800024d775c0 rbx 0x3 rdx 0x40000 acpi_pdirpa+0x2be68 rcx 0xffff800022d4e000 rax 0xffff800000a5bc00 r8 0xffffffff81b6af72 witness_checkorder+0xfe2 r9 0x5 r10 0x3 r11 0x44b346a8f126ae17 r12 0xfffffd800297b100 r13 0 r14 0xffffffff825e0ad0 w_lodata+0x39d60 r15 0xffffffff825fbd50 w_lodata+0x54fe0 rip 0xffffffff819657f8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800024d775b0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.1) pid=75574 stat=onproc flags process=10 proc=4000000 pri=79, usrpri=79, nice=20 forw=0xffffffffffffffff, list=0xffff800020a98ee8,0xffff800020aa7b48 process=0xffff800020aa31c0 user=0xffff800024d72000, vmspace=0xfffffd807f004a10 estcpu=29, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 63029 372387 90086 32767 7 0x10 syz-executor.0 63029 400242 90086 32767 3 0x4000090 kqread syz-executor.0 11994 327794 3927 32767 2 0x10 syz-executor.1 *11994 75574 3927 32767 7 0x4000010 syz-executor.1 11994 136153 3927 32767 3 0x4000090 fsleep syz-executor.1 3927 369139 40818 32767 3 0x90 nanosleep syz-executor.1 40818 494552 17036 0 3 0x82 wait syz-executor.1 90086 365621 11282 32767 3 0x90 nanosleep syz-executor.0 11282 76176 17036 0 3 0x82 wait syz-executor.0 4916 8279 0 0 3 0x14200 bored sosplice 17036 118941 29984 0 3 0x82 thrsleep syz-fuzzer 17036 498076 29984 0 3 0x4000082 thrsleep syz-fuzzer 17036 479893 29984 0 3 0x4000082 thrsleep syz-fuzzer 17036 181117 29984 0 3 0x4000082 thrsleep syz-fuzzer 17036 131822 29984 0 3 0x4000082 kqread syz-fuzzer 17036 439374 29984 0 3 0x4000082 thrsleep syz-fuzzer 17036 25874 29984 0 3 0x4000082 thrsleep syz-fuzzer 17036 480714 29984 0 3 0x4000082 thrsleep syz-fuzzer 17036 192099 29984 0 3 0x4000082 thrsleep syz-fuzzer 17036 109169 29984 0 3 0x4000082 thrsleep syz-fuzzer 29984 522560 76288 0 3 0x10008a pause ksh 76288 459645 68240 0 3 0x92 select sshd 47043 255005 1 0 3 0x100083 ttyin getty 68240 506346 1 0 3 0x80 select sshd 16538 497861 22853 73 3 0x100090 kqread syslogd 22853 208831 1 0 3 0x100082 netio syslogd 70811 132145 1 77 3 0x100090 poll dhclient 42490 38612 1 0 3 0x80 poll dhclient 72697 80413 0 0 2 0x14200 zerothread 24910 298071 0 0 3 0x14200 aiodoned aiodoned 9202 417516 0 0 3 0x14200 syncer update 30489 436706 0 0 3 0x14200 cleaner cleaner 30834 381699 0 0 3 0x14200 reaper reaper 71676 365028 0 0 3 0x14200 pgdaemon pagedaemon 61698 189680 0 0 3 0x14200 bored crynlk 39949 120817 0 0 3 0x14200 bored crypto 33608 197494 0 0 3 0x14200 bored viomb 2212 475406 0 0 3 0x40014200 acpi0 acpi0 2665 233706 0 0 3 0x40014200 idle1 13569 83486 0 0 3 0x14200 bored softnet 37866 251984 0 0 3 0x14200 bored systqmp 27472 279432 0 0 3 0x14200 bored systq 11896 225574 0 0 3 0x40014200 bored softclock 85581 134669 0 0 3 0x40014200 idle0 69723 149415 0 0 3 0x14200 bored smr 1 441663 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 11994 (syz-executor.1) thread 0xffff800020a98018 (75574) shared rwlock vmmaplk r = 0 (0xfffffd807f004a28) #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 9503 6344K 6344K 78643K 12814 0 pcb 13 10K 12K 78643K 15 0 rtable 115 3K 3K 78643K 23644 0 ifaddr 39 21K 28K 78643K 4013 0 counters 39 33K 33K 78643K 39 0 ioctlops 0 0K 2K 78643K 957 0 iov 0 0K 64K 78643K 4080 0 mount 1 1K 1K 78643K 1 0 vnodes 1215 76K 76K 78643K 15865 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 9K 78643K 269 0 VM map 2 1K 1K 78643K 2 0 sem 12 0K 1K 78643K 7821 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1810 197K 290K 78643K 12817 0 file desc 8 25K 33K 78643K 28937 0 sigio 0 0K 0K 78643K 523 0 proc 48 50K 83K 78643K 26822 0 subproc 34 2K 2K 78643K 9469 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 0K 78643K 3037 0 in_multi 33 2K 2K 78643K 6889 0 ether_multi 1 0K 0K 78643K 140 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 204 901K 901K 78643K 204 0 exec 0 0K 1K 78643K 10036 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 280 32K 42K 78643K 99566 0 UVM aobj 130 4K 4K 78643K 130 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 1 0K 1K 78643K 6719 0 NDP 5 0K 0K 78643K 1674 0 temp 106 3034K 3146K 78643K 126123 0 kqueue 0 0K 0K 78643K 529 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 1172 0 1165 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtpcb 80 3802 0 3798 1 0 1 1 0 8 0 rtentry 112 5658 0 5609 2 0 2 2 0 8 0 unpcb 120 32412 0 32387 44 42 2 2 0 8 0 syncache 264 318 0 318 90 89 1 1 0 8 1 sackhl 24 7 0 7 5 5 0 1 0 8 0 tcpqe 32 169 0 169 55 54 1 1 0 8 1 tcpcb 544 20691 0 20681 160 157 3 14 0 8 2 ipq 40 253 0 253 84 84 0 1 0 8 0 ipqe 40 8397 0 8397 84 84 0 1 0 8 0 inpcb 280 41516 0 41501 151 148 3 9 0 8 1 ip6q 72 13 0 13 9 9 0 1 0 8 0 ip6af 40 296 0 296 9 9 0 1 0 8 0 nd6 48 1117 0 1113 1 0 1 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 25056 0 24780 20 2 18 18 0 8 0 art_table 32 25057 0 24780 16 13 3 3 0 8 0 art_node 16 5657 0 5612 1 0 1 1 0 8 0 semapl 112 7819 0 7809 1 0 1 1 0 8 0 shmpl 112 128 0 0 4 0 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 34907 0 33471 47 0 47 47 0 8 0 ffsino 272 34907 0 33471 98 2 96 96 0 8 0 nchpl 144 73680 0 72025 65 3 62 62 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 355655 0 355655 5 4 1 2 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scxspl 192 207586 0 207586 200 197 3 6 0 8 3 plimitpl 152 5635 0 5626 1 0 1 1 0 8 0 sigapl 432 27443 0 27427 27 25 2 3 0 8 0 futexpl 56 521164 0 521163 2 1 1 1 0 8 0 knotepl 112 11216 0 11197 21 19 2 3 0 8 1 kqueuepl 104 26066 0 26063 40 39 1 4 0 8 0 pipepl 160 30490 0 30470 73 71 2 4 0 8 1 fdescpl 488 27444 0 27427 5 2 3 3 0 8 0 filepl 152 298015 0 297910 316 311 5 14 0 8 0 lockfpl 104 7325 0 7323 1 0 1 1 0 8 0 lockfspl 48 2603 0 2601 1 0 1 1 0 8 0 sessionpl 112 572 0 562 1 0 1 1 0 8 0 pgrppl 48 1382 0 1372 1 0 1 1 0 8 0 ucredpl 96 82360 0 82351 1 0 1 1 0 8 0 zombiepl 144 27427 0 27427 3 2 1 1 0 8 1 processpl 904 27461 0 27427 28 24 4 5 0 8 0 procpl 632 73487 0 73441 25 20 5 5 0 8 1 srpgc 64 1110 0 1110 78 77 1 1 0 8 1 sosppl 128 544 0 544 103 102 1 1 0 8 1 sockpl 384 78352 0 78306 306 299 7 16 0 8 0 mcl64k 65536 87 0 0 4 1 3 4 0 8 0 mcl16k 16384 103 0 0 8 5 3 3 0 8 0 mcl12k 12288 86 0 0 4 2 2 2 0 8 0 mcl9k 9216 62 0 0 3 1 2 2 0 8 0 mcl8k 8192 57 0 0 5 2 3 3 0 8 0 mcl4k 4096 17 0 0 3 0 3 3 0 8 0 mcl2k2 2112 22 0 0 2 0 2 2 0 8 0 mcl2k 2048 1560 0 0 28 16 12 15 0 8 0 mtagpl 80 1 0 0 1 0 1 1 0 8 0 mbufpl 256 2496 0 0 47 20 27 47 0 8 0 bufpl 280 58838 0 51772 506 0 506 506 0 8 0 anonpl 16 3167344 0 3153598 330 264 66 74 0 125 0 amapchunkpl 152 254480 0 254251 464 455 9 19 0 158 0 amappl16 192 122633 0 121888 811 766 45 50 0 8 7 amappl15 184 4684 0 4676 1 0 1 1 0 8 0 amappl14 176 9322 0 9309 2 1 1 1 0 8 0 amappl13 168 4467 0 4467 54 54 0 1 0 8 0 amappl12 160 2634 0 2626 2 1 1 1 0 8 0 amappl11 152 4141 0 4130 1 0 1 1 0 8 0 amappl10 144 2557 0 2548 1 0 1 1 0 8 0 amappl9 136 9735 0 9732 1 0 1 1 0 8 0 amappl8 128 7384 0 7175 8 1 7 7 0 8 0 amappl7 120 5593 0 5577 1 0 1 1 0 8 0 amappl6 112 2854 0 2825 1 0 1 1 0 8 0 amappl5 104 7414 0 7403 1 0 1 1 0 8 0 amappl4 96 28028 0 27978 19 17 2 2 0 8 0 amappl3 88 5725 0 5718 1 0 1 1 0 8 0 amappl2 80 181371 0 181274 6 4 2 3 0 8 0 amappl1 72 748913 0 748426 26 16 10 20 0 8 0 amappl 80 82780 0 82737 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 129 0 0 3 0 3 3 0 8 0 uaddrrnd 24 27444 0 27427 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 27444 0 27427 1 0 1 1 0 8 0 vmmpekpl 168 264919 0 264890 5 2 3 3 0 8 0 vmmpepl 168 3682627 0 3680259 796 664 132 150 0 357 22 vmsppl 368 27443 0 27427 2 0 2 2 0 8 0 pdppl 4096 54895 0 54854 8 2 6 6 0 8 0 pvpl 32 9222319 0 9204841 838 674 164 179 0 265 0 pmappl 232 27443 0 27427 63 62 1 2 0 8 0 extentpl 40 50 0 32 1 0 1 1 0 8 0 phpool 112 423 0 237 8 2 6 7 0 8 0