witness: lock order reversal: 1st 0xfffffd806e8bf8c0 vmmaplk (&map->lock) 2nd 0xfffffd806e3d0920 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_read+0x66 sys/kern/kern_rwlock.c:109 #2 uvmfault_lookup+0xd9 sys/uvm/uvm_fault.c:1448 #3 uvm_fault+0x7f sys/uvm/uvm_fault.c:524 #4 pageflttrap+0x20b sys/arch/amd64/amd64/trap.c:199 #5 kerntrap+0xec sys/arch/amd64/amd64/trap.c:287 #6 alltraps_kern_meltdown+0x7b #7 copyout+0x53 #8 ffs_read+0x362 sys/ufs/ffs/ffs_vnops.c:254 #9 VOP_READ+0xbf sys/kern/vfs_vops.c:248 #10 vn_read+0x124 sys/kern/vfs_vnops.c:375 #11 dofilereadv+0x1a2 sys/kern/sys_generic.c:236 #12 sys_read+0x83 sys/kern/sys_generic.c:156 #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 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(fffffd806e3d0920,9,0) at witness_checkorder+0x1009 witness_debugger sys/kern/subr_witness.c:2504 [inline] witness_checkorder(fffffd806e3d0920,9,0) at witness_checkorder+0x1009 sys/kern/subr_witness.c:1086 rw_enter(fffffd806e3d0910,81) at rw_enter+0xd4 rrw_enter(fffffd806e3d0910,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:453 VOP_LOCK(fffffd806e3a6838,81) at VOP_LOCK+0xf9 sys/kern/vfs_vops.c:615 vn_lock(fffffd806e3a6838,81) at vn_lock+0x81 sys/kern/vfs_vnops.c:571 uvn_io(fffffd80733d2008,ffff800020b07a28,1,2,0) at uvn_io+0x2c8 sys/uvm/uvm_vnode.c:1189 uvn_get(fffffd80733d2008,8000000000000000,ffff800020b07c80,ffff800020b07c14,0,0) at uvn_get+0x226 sys/uvm/uvm_vnode.c:1049 uvm_fault(fffffd806e8bf8a8,20000000,2,2) at uvm_fault+0x11cc sys/uvm/uvm_fault.c:1023 uvm_fault_wire(fffffd806e8bf8a8,20000000,20003000,2) at uvm_fault_wire+0x70 sys/uvm/uvm_fault.c:1295 uvm_map_pageable_wire(fffffd806e8bf8a8,fffffd806ed874c8,fffffd806e915d80,0,ffffffff81ad3527,0) at uvm_map_pageable_wire+0x2dd sys/uvm/uvm_map.c:2358 sys_mlock(ffff800020ad0c68,ffff800020b07e78,ffff800020b07ec0) at sys_mlock+0x185 sys/uvm/uvm_mmap.c:765 syscall(ffff800020b07f40) at syscall+0x4a4 mi_syscall sys/sys/syscall_mi.h:92 [inline] syscall(ffff800020b07f40) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:555 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffe0530, count: -14 ddb{0}> show registers rdi 0x3 rsi 0xffffffff824d0560 __sancov_gen_cov_switch_values.129 rbp 0xffff800020b076a0 rbx 0x3 rdx 0x8b rcx 0x3 rax 0x3 r8 0xffffffff81ad1322 witness_checkorder+0xfe2 r9 0x5 r10 0xe447bcb076850b02 r11 0xddda2b0f0e9c6e0 r12 0xfffffd800297f240 r13 0 r14 0xffffffff825d5af0 w_lodata+0x4ed90 r15 0xffffffff825dad70 w_lodata+0x54010 rip 0xffffffff8129eb48 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800020b07690 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor2121) pid=481767 stat=onproc flags process=2 proc=0 pri=50, usrpri=50, nice=20 forw=0xffffffffffffffff, list=0xffff800020ad0010,0xffffffff8260dd10 process=0xffff800020aece38 user=0xffff800020b02000, vmspace=0xfffffd806e8bf8a8 estcpu=0, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND *40392 481767 40220 0 7 0x2 syz-executor2121 40220 488410 20942 0 3 0x10008a pause ksh 20942 442566 63321 0 3 0x92 select sshd 26311 253616 1 0 3 0x100083 ttyin getty 63321 462048 1 0 3 0x80 select sshd 97440 483449 94534 73 3 0x100090 kqread syslogd 94534 244533 1 0 3 0x100082 netio syslogd 43898 517617 1 77 3 0x100090 poll dhclient 42362 159396 1 0 3 0x80 poll dhclient 37880 206914 0 0 3 0x14200 pgzero zerothread 58583 163947 0 0 3 0x14200 aiodoned aiodoned 70849 494129 0 0 3 0x14200 syncer update 19808 229334 0 0 3 0x14200 cleaner cleaner 37848 371853 0 0 3 0x14200 reaper reaper 73904 46265 0 0 3 0x14200 pgdaemon pagedaemon 70422 183018 0 0 3 0x14200 bored crynlk 68769 271196 0 0 3 0x14200 bored crypto 94403 23768 0 0 3 0x40014200 acpi0 acpi0 72686 64380 0 0 7 0x40014200 idle1 80649 372179 0 0 3 0x14200 bored softnet 24661 493359 0 0 3 0x14200 bored systqmp 97781 120697 0 0 3 0x14200 bored systq 92668 80854 0 0 3 0x40014200 bored softclock 42132 352542 0 0 3 0x40014200 idle0 3660 408637 0 0 3 0x14200 bored smr 1 275515 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 40392 (syz-executor2121) thread 0xffff800020ad0c68 (481767) shared rwlock vmmaplk r = 0 (0xfffffd806e8bf8c0) #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:5409 #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 (0xffffffff82650348) #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 9454 6326K 6327K 78643K 10545 0 pcb 13 8K 8K 78643K 13 0 rtable 61 2K 2K 78643K 117 0 ifaddr 24 7K 7K 78643K 24 0 counters 39 33K 33K 78643K 39 0 ioctlops 0 0K 2K 78643K 13 0 mount 1 1K 1K 78643K 1 0 vnodes 1180 74K 74K 78643K 1185 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 1K 78643K 2 0 VM map 2 1K 1K 78643K 2 0 sem 2 0K 0K 78643K 2 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1809 196K 290K 78643K 12766 0 file desc 1 0K 0K 78643K 1 0 proc 47 50K 58K 78643K 278 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 in_multi 11 0K 0K 78643K 11 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 18 79K 79K 78643K 18 0 exec 0 0K 1K 78643K 151 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 62 3K 3K 78643K 709 0 UVM aobj 2 2K 2K 78643K 2 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 NDP 3 0K 0K 78643K 3 0 temp 21 3019K 3083K 78643K 1712 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 2 0 0 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtpcb 80 15 0 13 1 0 1 1 0 8 0 rtentry 112 23 0 1 1 0 1 1 0 8 0 unpcb 120 27 0 19 1 0 1 1 0 8 0 syncache 264 5 0 5 2 1 1 1 0 8 1 tcpcb 544 8 0 5 1 0 1 1 0 8 0 inpcb 280 22 0 16 1 0 1 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 96 0 0 6 0 6 6 0 8 0 art_table 32 97 0 0 1 0 1 1 0 8 0 art_node 16 22 0 2 1 0 1 1 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino1pl 128 1393 0 15 45 0 45 45 0 8 0 ffsino 272 1393 0 15 92 0 92 92 0 8 0 nchpl 144 1567 0 31 57 0 57 57 0 8 0 uvmvnodes 72 1402 0 0 26 0 26 26 0 8 0 vnodes 208 1402 0 0 74 0 74 74 0 8 0 namei 1024 3479 0 3479 2 1 1 1 0 8 1 percpumem 16 30 0 0 1 0 1 1 0 8 0 scxspl 192 2460 0 2460 2 1 1 2 0 8 1 plimitpl 152 13 0 8 1 0 1 1 0 8 0 sigapl 432 176 0 166 2 0 2 2 0 8 0 knotepl 112 5 0 0 1 0 1 1 0 8 0 kqueuepl 104 1 0 0 1 0 1 1 0 8 0 pipepl 160 114 0 107 2 1 1 1 0 8 0 fdescpl 488 177 0 166 2 0 2 2 0 8 0 filepl 152 858 0 814 2 0 2 2 0 8 0 lockfpl 104 6 0 4 1 0 1 1 0 8 0 lockfspl 48 4 0 2 1 0 1 1 0 8 0 sessionpl 112 17 0 9 1 0 1 1 0 8 0 pgrppl 48 17 0 9 1 0 1 1 0 8 0 ucredpl 96 47 0 40 1 0 1 1 0 8 0 zombiepl 144 166 0 166 2 1 1 1 0 8 1 processpl 904 192 0 166 4 0 4 4 0 8 0 procpl 632 192 0 166 3 0 3 3 0 8 0 sockpl 384 64 0 48 2 0 2 2 0 8 0 mcl4k 4096 2 0 0 1 0 1 1 0 8 0 mcl2k 2048 78 0 0 10 0 10 10 0 8 0 mtagpl 80 1 0 0 1 0 1 1 0 8 0 mbufpl 256 104 0 0 7 0 7 7 0 8 0 bufpl 280 2101 0 258 132 0 132 132 0 8 0 anonpl 16 17338 0 16192 8 2 6 7 0 125 1 amapchunkpl 152 463 0 428 2 0 2 2 0 158 0 amappl16 192 35 0 33 1 0 1 1 0 8 0 amappl15 184 42 0 38 1 0 1 1 0 8 0 amappl14 176 13 0 12 2 1 1 1 0 8 0 amappl13 168 1 0 1 1 1 0 1 0 8 0 amappl12 160 4 0 4 1 1 0 1 0 8 0 amappl11 152 43 0 32 1 0 1 1 0 8 0 amappl10 144 3 0 3 2 1 1 1 0 8 1 amappl9 136 384 0 383 1 0 1 1 0 8 0 amappl8 128 64 0 60 1 0 1 1 0 8 0 amappl7 120 67 0 57 1 0 1 1 0 8 0 amappl6 112 43 0 41 1 0 1 1 0 8 0 amappl5 104 119 0 109 1 0 1 1 0 8 0 amappl4 96 399 0 374 1 0 1 1 0 8 0 amappl3 88 110 0 102 1 0 1 1 0 8 0 amappl2 80 689 0 635 3 1 2 2 0 8 0 amappl1 72 12186 0 11794 14 4 10 14 0 8 0 amappl 80 353 0 334 1 0 1 1 0 84 0 dma4096 4096 1 0 1 1 1 0 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 1 0 0 1 0 1 1 0 8 0 uaddrrnd 24 177 0 166 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 177 0 166 1 0 1 1 0 8 0 vmmpekpl 168 5087 0 5066 1 0 1 1 0 8 0 vmmpepl 168 26050 0 25267 45 7 38 45 0 357 3 vmsppl 368 176 0 166 2 0 2 2 0 8 0 pdppl 4096 361 0 332 5 0 5 5 0 8 0 pvpl 32 70444 0 67689 29 2 27 27 0 265 4 pmappl 232 176 0 166 1 0 1 1 0 8 0 extentpl 40 46 0 29 1 0 1 1 0 8 0 phpool 112 136 0 3 4 0 4 4 0 8 0