witness: lock order reversal: 1st 0xfffffd807f004018 vmmaplk (&map->lock) 2nd 0xfffffd806e60fc50 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(fffffd806e60fc50,9,0) at witness_checkorder+0x1009 witness_debugger sys/kern/subr_witness.c:2504 [inline] witness_checkorder(fffffd806e60fc50,9,0) at witness_checkorder+0x1009 sys/kern/subr_witness.c:1086 rw_enter(fffffd806e60fc40,81) at rw_enter+0xd4 rrw_enter(fffffd806e60fc40,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:453 VOP_LOCK(fffffd80717b50d0,81) at VOP_LOCK+0xf9 sys/kern/vfs_vops.c:615 vn_lock(fffffd80717b50d0,81) at vn_lock+0x81 sys/kern/vfs_vnops.c:571 uvn_io(fffffd80708048d0,ffff800024f7ca68,1,2,0) at uvn_io+0x2c8 sys/uvm/uvm_vnode.c:1189 uvn_get(fffffd80708048d0,0,ffff800024f7ccc0,ffff800024f7cc54,0,1) at uvn_get+0x226 sys/uvm/uvm_vnode.c:1049 uvm_fault(fffffd807f004000,20002000,2,1) at uvm_fault+0x11cc sys/uvm/uvm_fault.c:1023 uvm_fault_wire(fffffd807f004000,20002000,20003000,1) at uvm_fault_wire+0x70 sys/uvm/uvm_fault.c:1295 uvm_map_pageable_wire(fffffd807f004000,fffffd80650d46d0,fffffd80650d4a18,ffff800020b48000,0,0) at uvm_map_pageable_wire+0x2dd sys/uvm/uvm_map.c:2358 sys_mlock(ffff800020aa0c90,ffff800024f7ceb8,ffff800024f7cf00) at sys_mlock+0x185 sys/uvm/uvm_mmap.c:765 syscall(ffff800024f7cf80) at syscall+0x4a4 mi_syscall sys/sys/syscall_mi.h:92 [inline] syscall(ffff800024f7cf80) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:555 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xc988d538970, count: -14 ddb{0}> show registers rdi 0x3 rsi 0x3ffff acpi_pdirpa+0x2be67 rbp 0xffff800024f7c6e0 rbx 0x3 rdx 0x40000 acpi_pdirpa+0x2be68 rcx 0xffff800020b48000 rax 0xffff800000aa9300 r8 0xffffffff81b6af72 witness_checkorder+0xfe2 r9 0x5 r10 0x3 r11 0x1599cc8c559fc603 r12 0xfffffd800297b100 r13 0 r14 0xffffffff825e2180 w_lodata+0x3b410 r15 0xffffffff825fbd50 w_lodata+0x54fe0 rip 0xffffffff819657f8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800024f7c6d0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.1) pid=415303 stat=onproc flags process=10 proc=4000000 pri=86, usrpri=86, nice=20 forw=0xffffffffffffffff, list=0xffff800020aa07a0,0xffff800020aa0a28 process=0xffff800020aec3a0 user=0xffff800024f78000, vmspace=0xfffffd807f004000 estcpu=36, cpticks=3, pctcpu=0.0 user=0, sys=0, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 91698 68495 96887 32767 7 0x10 syz-executor.0 91698 25618 96887 32767 3 0x4000010 biowait syz-executor.0 81881 213589 36635 32767 2 0x10 syz-executor.1 *81881 415303 36635 32767 7 0x4000010 syz-executor.1 36635 278141 73285 32767 3 0x90 nanosleep syz-executor.1 73285 345920 25748 0 3 0x82 wait syz-executor.1 96887 494269 8990 32767 3 0x90 nanosleep syz-executor.0 8990 139087 25748 0 3 0x82 wait syz-executor.0 82853 152932 0 0 3 0x14200 bored sosplice 25748 252256 17195 0 3 0x82 thrsleep syz-fuzzer 25748 13357 17195 0 3 0x4000082 thrsleep syz-fuzzer 25748 106994 17195 0 3 0x4000082 thrsleep syz-fuzzer 25748 443720 17195 0 3 0x4000082 thrsleep syz-fuzzer 25748 175719 17195 0 3 0x4000082 thrsleep syz-fuzzer 25748 225327 17195 0 3 0x4000082 thrsleep syz-fuzzer 25748 102302 17195 0 3 0x4000082 thrsleep syz-fuzzer 25748 364800 17195 0 3 0x4000082 kqread syz-fuzzer 25748 417338 17195 0 3 0x4000082 thrsleep syz-fuzzer 25748 422004 17195 0 3 0x4000082 thrsleep syz-fuzzer 25748 13066 17195 0 3 0x4000082 thrsleep syz-fuzzer 17195 77357 18788 0 3 0x10008a pause ksh 18788 304614 81635 0 3 0x92 select sshd 55617 386831 1 0 3 0x100083 ttyin getty 81635 491439 1 0 3 0x80 select sshd 21760 295107 75768 73 3 0x100090 kqread syslogd 75768 354591 1 0 3 0x100082 netio syslogd 58282 191444 1 77 3 0x100090 poll dhclient 16925 324927 1 0 3 0x80 poll dhclient 42573 383082 0 0 2 0x14200 zerothread 25598 113547 0 0 3 0x14200 aiodoned aiodoned 3678 455142 0 0 3 0x14200 syncer update 24544 45653 0 0 3 0x14200 cleaner cleaner 23230 182029 0 0 3 0x14200 reaper reaper 80235 335132 0 0 3 0x14200 pgdaemon pagedaemon 42827 461238 0 0 3 0x14200 bored crynlk 80127 446284 0 0 3 0x14200 bored crypto 92233 107253 0 0 3 0x14200 bored viomb 13651 33290 0 0 3 0x40014200 acpi0 acpi0 14444 329455 0 0 3 0x40014200 idle1 71415 333404 0 0 3 0x14200 bored softnet 28060 244157 0 0 3 0x14200 bored systqmp 21842 413492 0 0 3 0x14200 bored systq 54999 174835 0 0 3 0x40014200 bored softclock 51057 366081 0 0 3 0x40014200 idle0 77681 91905 0 0 3 0x14200 bored smr 1 222870 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 91698 (syz-executor.0) thread 0xffff800020aa02b0 (25618) exclusive rrwlock inode r = 0 (0xfffffd8066dac2b8) #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 vn_write+0x11b sys/kern/vfs_vnops.c:411 #6 dofilewritev+0x1b7 sys/kern/sys_generic.c:364 #7 sys_writev+0xa7 sys/kern/sys_generic.c:311 #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 Process 81881 (syz-executor.1) thread 0xffff800020aa0c90 (415303) 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 ddb{0}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 9499 6344K 6344K 78643K 13346 0 pcb 13 10K 12K 78643K 15 0 rtable 113 3K 4K 78643K 29876 0 ifaddr 39 21K 29K 78643K 4976 0 counters 39 33K 33K 78643K 39 0 ioctlops 0 0K 2K 78643K 1306 0 iov 0 0K 64K 78643K 5154 0 mount 1 1K 1K 78643K 1 0 vnodes 1215 76K 76K 78643K 16185 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 9K 78643K 533 0 VM map 2 1K 1K 78643K 2 0 sem 12 0K 1K 78643K 11912 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1810 197K 290K 78643K 12817 0 file desc 8 25K 33K 78643K 28400 0 sigio 0 0K 0K 78643K 832 0 proc 48 50K 83K 78643K 32851 0 subproc 34 2K 2K 78643K 11747 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 2K 78643K 47133 0 in_multi 33 2K 2K 78643K 8218 0 ether_multi 1 0K 0K 78643K 63 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 180 795K 795K 78643K 180 0 exec 0 0K 1K 78643K 12347 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 235 38K 41K 78643K 107302 0 UVM aobj 130 5K 5K 78643K 133 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 2469 0 NDP 5 0K 0K 78643K 2076 0 temp 106 3034K 3128K 78643K 141116 0 kqueue 0 0K 0K 78643K 651 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 1488 0 1482 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtpcb 80 5510 0 5508 1 0 1 1 0 8 0 rtentry 112 7046 0 6998 2 0 2 2 0 8 0 unpcb 120 33776 0 33751 107 105 2 3 0 8 0 syncache 264 338 0 338 101 101 0 1 0 8 0 sackhl 24 8 0 8 8 8 0 1 0 8 0 tcpqe 32 980 0 980 81 81 0 1 0 8 0 tcpcb 544 26329 0 26322 338 337 1 14 0 8 0 ipq 40 348 0 348 98 97 1 1 0 8 1 ipqe 40 11505 0 11505 98 97 1 1 0 8 1 inpcb 280 73317 0 73295 254 251 3 10 0 8 0 ip6q 72 30 0 30 24 24 0 1 0 8 0 ip6af 40 477 0 477 24 24 0 1 0 8 0 nd6 48 1385 0 1381 1 0 1 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 31050 0 30777 21 3 18 18 0 8 0 art_table 32 31051 0 30777 15 12 3 3 0 8 0 art_node 16 7045 0 7001 1 0 1 1 0 8 0 sysvmsgpl 40 68 0 35 1 0 1 1 0 8 0 semupl 112 3 0 3 1 1 0 1 0 8 0 semapl 112 11907 0 11897 1 0 1 1 0 8 0 shmpl 112 131 0 3 4 0 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 29041 0 27563 50 2 48 48 0 8 0 ffsino 272 29041 0 27563 102 3 99 99 0 8 0 nchpl 144 62844 0 61185 70 8 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 330091 0 330091 7 6 1 2 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scxspl 192 198689 0 198688 225 224 1 7 0 8 0 plimitpl 152 5082 0 5073 1 0 1 1 0 8 0 sigapl 432 26504 0 26488 39 37 2 3 0 8 0 futexpl 56 593675 0 593675 7 6 1 1 0 8 1 knotepl 112 14976 0 14957 48 47 1 3 0 8 0 kqueuepl 104 22555 0 22553 69 68 1 4 0 8 0 pipepl 160 25076 0 25057 76 74 2 3 0 8 1 fdescpl 488 26505 0 26488 4 1 3 3 0 8 0 filepl 152 298903 0 298801 371 366 5 15 0 8 0 lockfpl 104 7966 0 7965 1 0 1 1 0 8 0 lockfspl 48 2537 0 2536 1 0 1 1 0 8 0 sessionpl 112 706 0 696 1 0 1 1 0 8 0 pgrppl 48 2535 0 2525 1 0 1 1 0 8 0 ucredpl 96 53791 0 53782 1 0 1 1 0 8 0 zombiepl 144 26488 0 26488 4 3 1 1 0 8 1 processpl 904 26522 0 26488 40 36 4 5 0 8 0 procpl 632 75402 0 75356 8 3 5 5 0 8 0 srpgc 64 1378 0 1378 88 87 1 1 0 8 1 sosppl 128 745 0 745 122 122 0 1 0 8 0 sockpl 384 113688 0 113648 478 471 7 17 0 8 1 mcl64k 65536 99 0 0 6 3 3 4 0 8 0 mcl16k 16384 88 0 0 9 7 2 3 0 8 0 mcl12k 12288 115 0 0 3 1 2 2 0 8 0 mcl9k 9216 83 0 0 5 4 1 2 0 8 0 mcl8k 8192 49 0 0 5 2 3 3 0 8 0 mcl4k 4096 25 0 0 3 0 3 3 0 8 0 mcl2k2 2112 21 0 0 2 0 2 2 0 8 0 mcl2k 2048 276 0 0 21 12 9 21 0 8 0 mtagpl 80 1 0 0 1 0 1 1 0 8 0 mbufpl 256 2771 0 0 43 5 38 39 0 8 0 bufpl 280 84775 0 77709 512 6 506 506 0 8 0 anonpl 16 3960126 0 3944855 406 329 77 86 0 125 0 amapchunkpl 152 275718 0 275457 517 506 11 20 0 158 0 amappl16 192 142245 0 141317 657 604 53 68 0 8 2 amappl15 184 4853 0 4850 1 0 1 1 0 8 0 amappl14 176 8221 0 8214 1 0 1 1 0 8 0 amappl13 168 2709 0 2707 58 57 1 1 0 8 0 amappl12 160 2261 0 2258 40 39 1 1 0 8 0 amappl11 152 4635 0 4623 1 0 1 1 0 8 0 amappl10 144 2608 0 2603 1 0 1 1 0 8 0 amappl9 136 11721 0 11713 1 0 1 1 0 8 0 amappl8 128 8109 0 7974 6 1 5 5 0 8 0 amappl7 120 6881 0 6865 1 0 1 1 0 8 0 amappl6 112 2852 0 2835 1 0 1 1 0 8 0 amappl5 104 7725 0 7716 1 0 1 1 0 8 0 amappl4 96 27427 0 27384 18 16 2 2 0 8 0 amappl3 88 5903 0 5896 1 0 1 1 0 8 0 amappl2 80 161284 0 161197 3 1 2 3 0 8 0 amappl1 72 765335 0 764868 24 14 10 20 0 8 0 amappl 80 87348 0 87302 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 132 0 3 3 0 3 3 0 8 0 uaddrrnd 24 26505 0 26488 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 26505 0 26488 1 0 1 1 0 8 0 vmmpekpl 168 253999 0 253969 3 0 3 3 0 8 0 vmmpepl 168 3901628 0 3899204 996 856 140 171 0 357 25 vmsppl 368 26504 0 26488 2 0 2 2 0 8 0 pdppl 4096 53017 0 52976 9 3 6 6 0 8 0 pvpl 32 10185839 0 10166703 1293 1106 187 203 0 265 16 pmappl 232 26504 0 26488 97 96 1 2 0 8 0 extentpl 40 50 0 32 1 0 1 1 0 8 0 phpool 112 613 0 419 6 0 6 6 0 8 0