witness: lock order reversal: 1st 0xfffffd807f005468 vmmaplk (&map->lock) 2nd 0xfffffd8065ca01b0 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(fffffd8065ca01b0,9,0) at witness_checkorder+0x1009 witness_debugger sys/kern/subr_witness.c:2504 [inline] witness_checkorder(fffffd8065ca01b0,9,0) at witness_checkorder+0x1009 sys/kern/subr_witness.c:1086 rw_enter(fffffd8065ca01a0,81) at rw_enter+0xd4 rrw_enter(fffffd8065ca01a0,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:453 VOP_LOCK(fffffd8061f26ea8,81) at VOP_LOCK+0xf9 sys/kern/vfs_vops.c:615 vn_lock(fffffd8061f26ea8,81) at vn_lock+0x81 sys/kern/vfs_vnops.c:571 uvn_io(fffffd8061fa09a8,ffff800023be57d8,1,2,0) at uvn_io+0x2c8 sys/uvm/uvm_vnode.c:1189 uvn_get(fffffd8061fa09a8,8000000000000000,ffff800023be5a30,ffff800023be59c4,0,5) at uvn_get+0x226 sys/uvm/uvm_vnode.c:1049 uvm_fault(fffffd807f005450,20001000,2,5) at uvm_fault+0x11cc sys/uvm/uvm_fault.c:1023 uvm_fault_wire(fffffd807f005450,20001000,20002000,5) at uvm_fault_wire+0x70 sys/uvm/uvm_fault.c:1295 uvm_map_pageable_wire(fffffd807f005450,fffffd8065e099f8,fffffd8065e09218,ffff8000231aa000,ffffffff8211d1e7,0) at uvm_map_pageable_wire+0x2dd sys/uvm/uvm_map.c:2358 sys_mlock(ffff800020aa4a00,ffff800023be5c28,ffff800023be5c70) at sys_mlock+0x185 sys/uvm/uvm_mmap.c:765 syscall(ffff800023be5cf0) at syscall+0x4a4 mi_syscall sys/sys/syscall_mi.h:92 [inline] syscall(ffff800023be5cf0) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:555 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xdcd40ec1d40, count: -14 ddb{0}> show registers rdi 0x3 rsi 0x3ffff acpi_pdirpa+0x2be67 rbp 0xffff800023be5450 rbx 0x3 rdx 0x40000 acpi_pdirpa+0x2be68 rcx 0xffff8000231aa000 rax 0xffff8000009ca940 r8 0xffffffff8211afe2 witness_checkorder+0xfe2 r9 0x5 r10 0x3 r11 0xed3ce77d8a0de17d r12 0xfffffd800297c100 r13 0 r14 0xffffffff825fbe00 w_lodata+0x4c3a0 r15 0xffffffff82604ba0 w_lodata+0x55140 rip 0xffffffff815de968 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800023be5440 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.1) pid=420540 stat=onproc flags process=0 proc=4000000 pri=86, usrpri=86, nice=20 forw=0xffffffffffffffff, list=0xffff800020aa4020,0xffffffff82644068 process=0xffff800020aec018 user=0xffff800023be0000, vmspace=0xfffffd807f005450 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 60098 232456 23523 0 7 0 syz-executor.1 60098 118103 23523 0 3 0x4000080 ttyout syz-executor.1 60098 54954 23523 0 3 0x4000000 fdlock syz-executor.1 60098 350191 23523 0 3 0x4000000 fdlock syz-executor.1 *60098 420540 23523 0 7 0x4000000 syz-executor.1 55868 458697 12020 0 3 0x90 nanosleep syz-executor.0 55868 150386 12020 0 3 0x4000090 msgwait syz-executor.0 55868 398014 12020 0 3 0x4000090 msgwait syz-executor.0 55868 229289 12020 0 3 0x4000090 msgwait syz-executor.0 55868 21790 12020 0 3 0x4000090 msgwait syz-executor.0 55868 515512 12020 0 3 0x4000090 fsleep syz-executor.0 50477 445467 0 0 3 0x14200 bored sosplice 23523 408831 4166 0 3 0x82 nanosleep syz-executor.1 12020 27565 4166 0 3 0x82 nanosleep syz-executor.0 4166 93975 59439 0 3 0x82 kqread syz-fuzzer 4166 518961 59439 0 3 0x4000082 thrsleep syz-fuzzer 4166 1418 59439 0 3 0x4000082 thrsleep syz-fuzzer 4166 426101 59439 0 3 0x4000082 thrsleep syz-fuzzer 4166 174451 59439 0 3 0x4000082 thrsleep syz-fuzzer 4166 195335 59439 0 3 0x4000082 thrsleep syz-fuzzer 4166 449051 59439 0 3 0x4000082 thrsleep syz-fuzzer 4166 232098 59439 0 3 0x4000082 thrsleep syz-fuzzer 4166 112571 59439 0 3 0x4000082 thrsleep syz-fuzzer 4166 347705 59439 0 3 0x4000082 thrsleep syz-fuzzer 59439 179803 52332 0 3 0x10008a pause ksh 52332 464659 72584 0 3 0x92 select sshd 3312 255360 1 0 3 0x100083 ttyin getty 72584 326941 1 0 3 0x80 select sshd 13138 6743 41558 74 3 0x100092 bpf pflogd 41558 317493 1 0 3 0x80 netio pflogd 52112 75935 9206 73 3 0x100090 kqread syslogd 9206 134255 1 0 3 0x100082 netio syslogd 89411 230454 1 77 3 0x100090 poll dhclient 70914 107123 1 0 3 0x80 poll dhclient 97713 149341 0 0 3 0x14200 pgzero zerothread 55275 1612 0 0 3 0x14200 aiodoned aiodoned 8760 189807 0 0 3 0x14200 syncer update 91553 421543 0 0 3 0x14200 cleaner cleaner 43392 411133 0 0 3 0x14200 reaper reaper 78745 69319 0 0 3 0x14200 pgdaemon pagedaemon 8843 489796 0 0 3 0x14200 bored crynlk 39431 498993 0 0 3 0x14200 bored crypto 95935 339657 0 0 3 0x14200 bored viomb 75663 5749 0 0 3 0x40014200 acpi0 acpi0 8698 517446 0 0 3 0x40014200 idle1 85697 439225 0 0 3 0x14200 bored softnet 19631 516458 0 0 3 0x14200 bored systqmp 56531 435106 0 0 3 0x14200 bored systq 25124 366051 0 0 3 0x40014200 bored softclock 52224 212914 0 0 3 0x40014200 idle0 42750 308998 0 0 3 0x14200 bored smr 1 222644 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 60098 (syz-executor.1) thread 0xffff800020aa4510 (118103) exclusive rwlock fdlock r = 0 (0xfffffd806f0479f0) #0 witness_lock+0x52e sys/kern/subr_witness.c:1163 #1 dodup3+0x1a1 sys/kern/kern_descrip.c:361 #2 syscall+0x4a4 mi_syscall sys/sys/syscall_mi.h:92 [inline] #2 syscall+0x4a4 sys/arch/amd64/amd64/trap.c:555 #3 Xsyscall+0x128 Process 60098 (syz-executor.1) thread 0xffff800020aa4a00 (420540) shared rwlock vmmaplk r = 0 (0xfffffd807f005468) #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 (0xffffffff8265cfc8) #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 9512 6553K 6941K 78643K 10946 0 pcb 13 8K 8K 78643K 44 0 rtable 114 4K 4K 78643K 279 0 ifaddr 57 12K 13K 78643K 101 0 counters 39 33K 33K 78643K 39 0 ioctlops 0 0K 4K 78643K 1469 0 iov 0 0K 16K 78643K 32 0 mount 1 1K 1K 78643K 1 0 vnodes 1219 77K 77K 78643K 1339 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 5K 78643K 4 0 VM map 2 1K 1K 78643K 2 0 sem 12 0K 0K 78643K 33 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1810 197K 290K 78643K 12817 0 file desc 6 17K 25K 78643K 157 0 sigio 0 0K 0K 78643K 2 0 proc 60 63K 95K 78643K 455 0 subproc 32 2K 2K 78643K 34 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 0K 78643K 54 0 in_multi 33 2K 2K 78643K 47 0 ether_multi 1 0K 0K 78643K 1 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 42 185K 185K 78643K 42 0 exec 0 0K 1K 78643K 210 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 132 22K 23K 78643K 1477 0 UVM aobj 11 2K 2K 78643K 11 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 20 0 NDP 9 0K 0K 78643K 21 0 temp 112 3031K 3095K 78643K 3897 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 6 0 0 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtpcb 80 27 0 25 1 0 1 1 0 8 0 rtentry 112 46 0 1 2 0 2 2 0 8 0 unpcb 120 83 0 71 1 0 1 1 0 8 0 syncache 264 4 0 4 1 1 0 1 0 8 0 tcpqe 32 881 0 881 1 1 0 1 0 8 0 tcpcb 544 58 0 54 1 0 1 1 0 8 0 inpcb 280 212 0 204 2 0 2 2 0 8 1 rttmr 72 1 0 0 1 0 1 1 0 8 0 nd6 48 4 0 0 1 0 1 1 0 8 0 ppxss 1128 8 0 8 1 0 1 1 0 8 1 pffrag 232 1 0 1 1 0 1 1 0 482 1 pffrnode 88 1 0 1 1 0 1 1 0 8 1 pffrent 40 4 0 4 1 0 1 1 0 8 1 pfosfp 40 846 0 423 5 0 5 5 0 8 0 pfosfpen 112 1428 0 714 21 0 21 21 0 8 0 pfstitem 24 18 0 1 1 0 1 1 0 8 0 pfstkey 112 18 0 1 1 0 1 1 0 8 0 pfstate 328 18 0 1 2 0 2 2 0 8 0 pfrule 1360 21 0 16 2 1 1 2 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 236 0 0 15 0 15 15 0 8 0 art_table 32 237 0 0 2 0 2 2 0 8 0 art_node 16 45 0 4 1 0 1 1 0 8 0 sysvmsgpl 40 59 0 21 1 0 1 1 0 8 0 semupl 112 2 0 2 1 1 0 1 0 8 0 semapl 112 27 0 17 1 0 1 1 0 8 0 shmpl 112 9 0 0 1 0 1 1 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 1628 0 220 46 0 46 46 0 8 0 ffsino 272 1628 0 220 95 0 95 95 0 8 0 nchpl 144 2111 0 490 61 0 61 61 0 8 0 uvmvnodes 72 1752 0 0 32 0 32 32 0 8 0 vnodes 208 1752 0 0 93 0 93 93 0 8 0 namei 1024 5649 0 5649 1 0 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scxspl 192 5593 0 5593 8 4 4 7 0 8 4 plimitpl 152 22 0 14 1 0 1 1 0 8 0 sigapl 432 356 0 340 3 1 2 3 0 8 0 futexpl 56 2531 0 2530 1 0 1 1 0 8 0 knotepl 112 72 0 51 1 0 1 1 0 8 0 kqueuepl 104 60 0 54 1 0 1 1 0 8 0 pipepl 160 224 0 205 2 0 2 2 0 8 1 fdescpl 488 357 0 340 3 0 3 3 0 8 0 filepl 152 2331 0 2215 6 0 6 6 0 8 1 lockfpl 104 62 0 58 1 0 1 1 0 8 0 lockfspl 48 21 0 18 1 0 1 1 0 8 0 sessionpl 112 18 0 7 1 0 1 1 0 8 0 pgrppl 48 18 0 7 1 0 1 1 0 8 0 ucredpl 96 173 0 163 1 0 1 1 0 8 0 zombiepl 144 340 0 340 1 0 1 1 0 8 1 processpl 904 374 0 340 4 0 4 4 0 8 0 procpl 632 699 0 647 5 0 5 5 0 8 0 sosppl 128 3 0 3 1 0 1 1 0 8 1 sockpl 384 324 0 302 4 0 4 4 0 8 1 mcl64k 65536 2 0 0 1 0 1 1 0 8 0 mcl16k 16384 1 0 0 1 0 1 1 0 8 0 mcl12k 12288 2 0 0 1 0 1 1 0 8 0 mcl9k 9216 1 0 0 1 0 1 1 0 8 0 mcl8k 8192 2 0 0 1 0 1 1 0 8 0 mcl4k 4096 6 0 0 1 0 1 1 0 8 0 mcl2k2 2112 1 0 0 1 0 1 1 0 8 0 mcl2k 2048 179 0 0 22 0 22 22 0 8 0 mtagpl 80 10 0 0 1 0 1 1 0 8 0 mbufpl 256 211 0 0 13 0 13 13 0 8 0 bufpl 280 6471 0 1340 367 0 367 367 0 8 0 anonpl 16 49796 0 30442 80 1 79 79 0 125 0 amapchunkpl 152 1733 0 1559 8 1 7 8 0 158 0 amappl16 192 1636 0 587 54 0 54 54 0 8 1 amappl15 184 124 0 119 1 0 1 1 0 8 0 amappl14 176 33 0 27 1 0 1 1 0 8 0 amappl13 168 2 0 1 2 1 1 1 0 8 0 amappl12 160 15 0 13 2 1 1 1 0 8 0 amappl11 152 55 0 40 1 0 1 1 0 8 0 amappl10 144 74 0 69 1 0 1 1 0 8 0 amappl9 136 601 0 597 1 0 1 1 0 8 0 amappl8 128 135 0 103 2 0 2 2 0 8 0 amappl7 120 165 0 153 1 0 1 1 0 8 0 amappl6 112 56 0 50 1 0 1 1 0 8 0 amappl5 104 131 0 118 1 0 1 1 0 8 0 amappl4 96 613 0 578 1 0 1 1 0 8 0 amappl3 88 123 0 115 1 0 1 1 0 8 0 amappl2 80 1960 0 1877 3 1 2 3 0 8 0 amappl1 72 17881 0 17395 27 17 10 21 0 8 0 amappl 80 949 0 892 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 10 0 0 1 0 1 1 0 8 0 uaddrrnd 24 357 0 340 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 357 0 340 1 0 1 1 0 8 0 vmmpekpl 168 6936 0 6906 2 0 2 2 0 8 0 vmmpepl 168 51232 0 48842 143 16 127 134 0 357 23 vmsppl 368 356 0 340 2 0 2 2 0 8 0 pdppl 4096 721 0 680 6 0 6 6 0 8 0 pvpl 32 165208 0 142569 189 0 189 189 0 265 3 pmappl 232 356 0 340 2 1 1 2 0 8 0 extentpl 40 50 0 32 1 0 1 1 0 8 0 phpool 112 172 0 3 5 0 5 5 0 8 0