witness: lock order reversal: 1st 0xfffffd807effa468 vmmaplk (&map->lock) 2nd 0xfffffd8063d53700 inode (&ip->i_lock) lock order "&ip->i_lock"(rrwlock) -> "&map->lock"(rwlock) first seen at: #0 witness_checkorder+0x65e witness_lock_order_add sys/kern/subr_witness.c:2463 [inline] #0 witness_checkorder+0x65e sys/kern/subr_witness.c:880 #1 rw_enter_read+0x66 sys/kern/kern_rwlock.c:111 #2 uvmfault_lookup+0xd9 sys/uvm/uvm_fault.c:1495 #3 uvm_fault_check+0x3d sys/uvm/uvm_fault.c:513 #4 uvm_fault+0xdb sys/uvm/uvm_fault.c:694 #5 kpageflttrap+0x202 sys/arch/amd64/amd64/trap.c:265 #6 kerntrap+0xef sys/arch/amd64/amd64/trap.c:321 #7 alltraps_kern_meltdown+0x7b #8 copyout+0x53 #9 ffs_read+0x3e2 sys/ufs/ffs/ffs_vnops.c:258 #10 VOP_READ+0xbf sys/kern/vfs_vops.c:253 #11 vn_rdwr+0x10b #12 vmcmd_map_readvn+0xda sys/kern/exec_subr.c:246 #13 exec_process_vmcmds+0xb2 sys/kern/exec_subr.c:143 #14 sys_execve+0x9ff sys/kern/kern_exec.c:461 #15 syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] #15 syscall+0x4a1 sys/arch/amd64/amd64/trap.c:590 #16 Xsyscall+0x128 lock order "&map->lock"(rwlock) -> "&ip->i_lock"(rrwlock) first seen at: #0 witness_checkorder+0x65e witness_lock_order_add sys/kern/subr_witness.c:2463 [inline] #0 witness_checkorder+0x65e sys/kern/subr_witness.c:880 #1 rw_enter+0xd4 #2 rrw_enter+0x88 sys/kern/kern_rwlock.c:462 #3 VOP_LOCK+0x4b sys/kern/vfs_vops.c:614 #4 vn_lock+0x6c sys/kern/vfs_vnops.c:575 #5 uvn_get+0x276 uvm_vnode_lock sys/uvm/uvm_vnode.c:1499 [inline] #5 uvn_get+0x276 sys/uvm/uvm_vnode.c:993 #6 uvm_fault+0xa41 sys/uvm/uvm_fault.c:1073 #7 uvm_fault_wire+0x63 sys/uvm/uvm_fault.c:1342 #8 uvm_map_pageable_wire+0x30d sys/uvm/uvm_map.c:2367 #9 sys_mlock+0x180 sys/uvm/uvm_mmap.c:772 #10 syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] #10 syscall+0x4a1 sys/arch/amd64/amd64/trap.c:590 #11 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(fffffd8063d53700,9,0) at witness_checkorder+0xf5a witness_debugger sys/kern/subr_witness.c:2490 [inline] witness_checkorder(fffffd8063d53700,9,0) at witness_checkorder+0xf5a sys/kern/subr_witness.c:1087 rw_enter(fffffd8063d536f0,81) at rw_enter+0xd4 rrw_enter(fffffd8063d536f0,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:462 VOP_LOCK(fffffd8060c169d8,81) at VOP_LOCK+0x4b sys/kern/vfs_vops.c:614 vn_lock(fffffd8060c169d8,81) at vn_lock+0x6c sys/kern/vfs_vnops.c:575 uvn_get(fffffd80627f3ac8,0,ffff8000222e59e8,ffff8000222e5984,0,1) at uvn_get+0x276 uvm_vnode_lock sys/uvm/uvm_vnode.c:1499 [inline] uvn_get(fffffd80627f3ac8,0,ffff8000222e59e8,ffff8000222e5984,0,1) at uvn_get+0x276 sys/uvm/uvm_vnode.c:993 uvm_fault(fffffd807effa450,20ffc000,2,1) at uvm_fault+0xa41 sys/uvm/uvm_fault.c:1073 uvm_fault_wire(fffffd807effa450,20ffc000,20ffe000,1) at uvm_fault_wire+0x63 sys/uvm/uvm_fault.c:1342 uvm_map_pageable_wire(fffffd807effa450,fffffd8066b468f0,fffffd8066b46650,20f,ffffffff8235a62e,0) at uvm_map_pageable_wire+0x30d sys/uvm/uvm_map.c:2367 sys_mlock(ffff800021283208,ffff8000222e5bc8,ffff8000222e5c10) at sys_mlock+0x180 sys/uvm/uvm_mmap.c:772 syscall(ffff8000222e5c90) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000222e5c90) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:590 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xfe2725aaa30, count: -13 ddb{1}> show registers rdi 0x3 rsi 0x40000 acpi_pdirpa+0x2be68 rbp 0xffff8000222e54c0 rbx 0x3 rdx 0xffff800000b08940 rcx 0x3 rax 0x3ffff acpi_pdirpa+0x2be67 r8 0xffffffff823582d3 witness_checkorder+0xf33 r9 0x5 r10 0x5d115bb174e35f80 r11 0xaa2d8cc5dba50707 r12 0xffffffff828c5640 w_lodata+0x54430 r13 0 r14 0xffffffff828b4810 w_lodata+0x43600 r15 0xfffffd8002ce5500 rip 0xffffffff81f33568 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff8000222e54b0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{1}> show proc PROC (syz-executor.0) pid=44112 stat=onproc flags process=0 proc=4000000 pri=32, usrpri=78, nice=20 forw=0xffffffffffffffff, list=0xffff800021282018,0xffffffff828de248 process=0xffff8000212354b0 user=0xffff8000222e0000, vmspace=0xfffffd807effa450 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND 98800 303418 42802 0 7 0 syz-executor.0 *98800 44112 42802 0 7 0x4000000 syz-executor.0 30092 97953 4486 0 2 0 syz-executor.1 30092 60567 4486 0 2 0x4000000 syz-executor.1 4486 194934 50750 0 3 0x82 nanosleep syz-executor.1 42802 116428 50750 0 3 0x82 nanosleep syz-executor.0 50750 47633 17650 0 3 0x82 kqread syz-fuzzer 50750 436272 17650 0 3 0x4000082 thrsleep syz-fuzzer 50750 62156 17650 0 3 0x4000082 thrsleep syz-fuzzer 50750 165251 17650 0 3 0x4000082 thrsleep syz-fuzzer 50750 120150 17650 0 3 0x4000082 thrsleep syz-fuzzer 50750 95523 17650 0 3 0x4000082 thrsleep syz-fuzzer 50750 157432 17650 0 3 0x4000082 thrsleep syz-fuzzer 50750 18138 17650 0 3 0x4000082 thrsleep syz-fuzzer 17650 225631 36456 0 3 0x10008a pause ksh 36456 337456 41664 0 3 0x92 select sshd 8988 495070 1 0 3 0x100083 ttyin getty 41664 188029 1 0 3 0x80 select sshd 34608 432546 60145 74 3 0x100092 bpf pflogd 60145 447576 1 0 3 0x80 netio pflogd 87282 185805 52717 73 3 0x100090 kqread syslogd 52717 374499 1 0 3 0x100082 netio syslogd 44094 138858 1 77 3 0x100090 poll dhclient 70153 351343 1 0 3 0x80 poll dhclient 52722 20201 0 0 3 0x14200 bored smr 11168 303680 0 0 2 0x14200 zerothread 65963 299996 0 0 3 0x14200 aiodoned aiodoned 66805 314384 0 0 3 0x14200 syncer update 33983 206214 0 0 3 0x14200 cleaner cleaner 56910 496173 0 0 3 0x14200 reaper reaper 99151 257854 0 0 3 0x14200 pgdaemon pagedaemon 89217 107075 0 0 3 0x14200 bored crynlk 96535 447514 0 0 3 0x14200 bored crypto 59029 252017 0 0 3 0x14200 bored viomb 48190 292823 0 0 3 0x40014200 acpi0 acpi0 64029 184653 0 0 3 0x40014200 idle1 3878 60478 0 0 3 0x14200 bored softnet 78152 94626 0 0 3 0x14200 bored systqmp 21122 353484 0 0 3 0x14200 bored systq 94639 390300 0 0 3 0x40014200 bored softclock 69431 116940 0 0 3 0x40014200 idle0 1 337592 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{1}> show all locks Process 98800 (syz-executor.0) thread 0xffff800021283208 (44112) shared rwlock vmmaplk r = 0 (0xfffffd807effa468) #0 witness_lock+0x4b0 stacktrace_save sys/sys/stacktrace.h:36 [inline] #0 witness_lock+0x4b0 sys/kern/subr_witness.c:1164 #1 rw_enter+0x446 sys/kern/kern_rwlock.c:311 #2 vm_map_lock_ln+0xda sys/uvm/uvm_map.c:5463 #3 uvm_map_pageable+0x120 sys/uvm/uvm_map.c:2463 #4 sys_mlock+0x180 sys/uvm/uvm_mmap.c:772 #5 syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] #5 syscall+0x4a1 sys/arch/amd64/amd64/trap.c:590 #6 Xsyscall+0x128 exclusive kernel_lock &kernel_lock r = 0 (0xffffffff828db810) #0 witness_lock+0x4b0 stacktrace_save sys/sys/stacktrace.h:36 [inline] #0 witness_lock+0x4b0 sys/kern/subr_witness.c:1164 #1 syscall+0x3fd mi_syscall sys/sys/syscall_mi.h:93 [inline] #1 syscall+0x3fd sys/arch/amd64/amd64/trap.c:590 #2 Xsyscall+0x128 ddb{1}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 9484 6416K 6738K 78643K 12206 0 pcb 13 8K 8K 78643K 23 0 rtable 105 3K 3K 78643K 199 0 ifaddr 44 10K 10K 78643K 45 0 counters 43 33K 33K 78643K 43 0 ioctlops 0 0K 4K 78643K 1507 0 mount 1 1K 1K 78643K 1 0 vnodes 1219 77K 77K 78643K 1463 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 5K 78643K 6 0 VM map 2 1K 1K 78643K 2 0 sem 11 1K 1K 78643K 13 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1825 197K 290K 78643K 13109 0 file desc 6 17K 25K 78643K 53594 0 sigio 0 0K 0K 78643K 1 0 proc 60 63K 95K 78643K 448 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 2 0 in_multi 33 2K 2K 78643K 40 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 31 148K 148K 78643K 31 0 exec 0 0K 2K 78643K 358 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 246 40K 40K 78643K 108752 0 UVM aobj 10 2K 2K 78643K 10 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 NDP 6 0K 0K 78643K 10 0 temp 66 3955K 4019K 78643K 110208 0 kqueue 3 4K 4K 78643K 3 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 6 0 0 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtpcb 120 21 0 19 1 0 1 1 0 8 0 rtentry 112 45 0 1 2 0 2 2 0 8 0 unpcb 120 67 0 57 1 0 1 1 0 8 0 syncache 296 4 0 4 1 1 0 1 0 8 0 tcpqe 32 447 0 447 2 2 0 1 0 8 0 tcpcb 736 59 0 55 3 2 1 2 0 8 0 inpcb 296 104 0 97 2 1 1 2 0 8 0 nd6 48 6 0 0 1 0 1 1 0 8 0 kcovpl 48 2 0 0 1 0 1 1 0 8 0 pfosfp 40 1428 0 1005 5 0 5 5 0 8 0 pfosfpen 112 1428 0 714 21 0 21 21 0 8 0 pfstitem 24 15 0 13 1 0 1 1 0 8 0 pfstkey 112 15 0 13 1 0 1 1 0 8 0 pfstate 328 15 0 13 2 1 1 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 188 0 0 12 0 12 12 0 8 0 art_table 32 189 0 0 2 0 2 2 0 8 0 art_node 16 44 0 4 1 0 1 1 0 8 0 semupl 112 2 0 2 1 1 0 1 0 8 0 semapl 112 9 0 0 1 0 1 1 0 8 0 shmpl 112 7 0 0 1 0 1 1 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 55011 0 53605 88 0 88 88 0 8 0 ffsino 272 55011 0 53605 95 1 94 94 0 8 0 nchpl 144 108874 0 107269 60 0 60 60 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 220761 0 220761 2 1 1 1 0 8 1 percpumem 16 32 0 0 1 0 1 1 0 8 0 scxspl 216 326669 0 326669 9 8 1 8 0 8 1 plimitpl 152 17 0 9 1 0 1 1 0 8 0 sigapl 424 53810 0 53777 4 0 4 4 0 8 0 futexpl 56 208362 0 208362 1 0 1 1 0 8 1 knotepl 112 62 0 42 1 0 1 1 0 8 0 kqueuepl 152 52066 0 52064 1 0 1 1 0 8 0 pipepl 304 120 0 109 4 3 1 2 0 8 0 fdescpl 496 53794 0 53777 3 0 3 3 0 8 0 filepl 152 108832 0 108729 6 1 5 5 0 8 0 lockfpl 104 18 0 17 1 0 1 1 0 8 0 lockfspl 48 9 0 8 1 0 1 1 0 8 0 sessionpl 144 18 0 7 1 0 1 1 0 8 0 pgrppl 48 19 0 8 1 0 1 1 0 8 0 ucredpl 96 712 0 703 1 0 1 1 0 8 0 zombiepl 144 53777 0 53777 2 1 1 1 0 8 1 processpl 1056 53810 0 53777 3 0 3 3 0 8 0 procpl 656 107797 0 107755 5 1 4 5 0 8 0 sockpl 400 192 0 173 3 0 3 3 0 8 0 mcl64k 65536 3 0 0 1 0 1 1 0 8 0 mcl12k 12288 17 0 0 2 0 2 2 0 8 0 mcl9k 9216 14 0 0 1 0 1 1 0 8 0 mcl8k 8192 3 0 0 1 0 1 1 0 8 0 mcl4k 4096 3 0 0 1 0 1 1 0 8 0 mcl2k 2048 370 0 0 44 6 38 44 0 8 0 mtagpl 96 193 0 0 5 0 5 5 0 8 0 mbufpl 256 983 0 0 37 0 37 37 0 8 0 bufpl 280 57071 0 50821 447 0 447 447 0 8 0 anonpl 16 3132614 0 3098621 149 1 148 148 0 124 0 amapchunkpl 152 163743 0 162548 52 3 49 49 0 158 0 amappl16 192 130961 0 129899 59 5 54 54 0 8 0 amappl15 184 2 0 1 1 0 1 1 0 8 0 amappl14 176 26836 0 26830 1 0 1 1 0 8 0 amappl13 168 27 0 25 1 0 1 1 0 8 0 amappl12 160 14 0 10 1 0 1 1 0 8 0 amappl11 152 26808 0 26789 1 0 1 1 0 8 0 amappl10 144 12 0 10 1 0 1 1 0 8 0 amappl9 136 366 0 366 1 1 0 1 0 8 0 amappl8 128 148 0 109 3 1 2 2 0 8 0 amappl7 120 244 0 236 1 0 1 1 0 8 0 amappl6 112 71 0 59 1 0 1 1 0 8 0 amappl5 104 80603 0 80582 1 0 1 1 0 8 0 amappl4 96 280 0 252 1 0 1 1 0 8 0 amappl3 88 360 0 352 1 0 1 1 0 8 0 amappl2 80 401344 0 401270 3 1 2 3 0 8 0 amappl1 72 1510321 0 1509827 25 15 10 19 0 8 0 amappl 80 108196 0 108004 4 0 4 4 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 9 0 0 1 0 1 1 0 8 0 uaddrrnd 24 53794 0 53777 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 53794 0 53777 1 0 1 1 0 8 0 vmmpekpl 168 167726 0 167701 2 0 2 2 0 8 0 vmmpepl 168 6637201 0 6634689 178 67 111 143 0 357 1 vmsppl 368 53793 0 53777 2 0 2 2 0 8 0 pdppl 4096 107595 0 107554 65 24 41 45 0 8 0 pvpl 32 14899078 0 14861829 327 4 323 327 0 265 0 pmappl 232 53793 0 53777 2 1 1 2 0 8 0 extentpl 40 57 0 39 1 0 1 1 0 8 0 phpool 112 363 0 37 10 0 10 10 0 8 0 ddb{1}> machine ddbcpu 0 Stopped at x86_ipi_db+0x1a: addq $0x8,%rsp ddb{0}> trace x86_ipi_db(ffffffff8274aff0) at x86_ipi_db+0x1a sys/arch/amd64/amd64/db_interface.c:352 x86_ipi_handler() at x86_ipi_handler+0xb7 sys/arch/amd64/amd64/ipi.c:106 Xresume_lapic_ipi() at Xresume_lapic_ipi+0x23 __mp_lock(ffffffff828db608) at __mp_lock+0x122 __mp_lock_spin sys/kern/kern_lock.c:116 [inline] __mp_lock(ffffffff828db608) at __mp_lock+0x122 sys/kern/kern_lock.c:147 intr_handler(ffff8000212c0ee0,ffff80000065a300) at intr_handler+0x5e sys/arch/amd64/amd64/intr.c:532 Xintr_ioapic_edge4_untramp() at Xintr_ioapic_edge4_untramp+0x19f __sanitizer_cov_trace_pc() at __sanitizer_cov_trace_pc+0x37 kd_curproc sys/dev/kcov.c:570 [inline] __sanitizer_cov_trace_pc() at __sanitizer_cov_trace_pc+0x37 sys/dev/kcov.c:143 __mp_lock(ffffffff828db608) at __mp_lock+0x133 __mp_lock_spin sys/kern/kern_lock.c:116 [inline] __mp_lock(ffffffff828db608) at __mp_lock+0x133 sys/kern/kern_lock.c:147 softintr_dispatch(0) at softintr_dispatch+0x4e sys/arch/amd64/amd64/softintr.c:90 Xsoftclock() at Xsoftclock+0x1f clock_gettime(ffff800021283c48,3,ffff8000212c1168) at clock_gettime+0x4c sys/kern/kern_time.c:114 sys_clock_gettime(ffff800021283c48,ffff8000212c11d0,ffff8000212c1220) at sys_clock_gettime+0x4c sys/kern/kern_time.c:165 syscall(ffff8000212c12a0) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000212c12a0) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:590 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffc0ca0, count: -14 ddb{0}> machine ddbcpu 1 Stopped at db_enter+0x18: addq $0x8,%rsp ddb{1}> trace db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398 witness_checkorder(fffffd8063d53700,9,0) at witness_checkorder+0xf5a witness_debugger sys/kern/subr_witness.c:2490 [inline] witness_checkorder(fffffd8063d53700,9,0) at witness_checkorder+0xf5a sys/kern/subr_witness.c:1087 rw_enter(fffffd8063d536f0,81) at rw_enter+0xd4 rrw_enter(fffffd8063d536f0,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:462 VOP_LOCK(fffffd8060c169d8,81) at VOP_LOCK+0x4b sys/kern/vfs_vops.c:614 vn_lock(fffffd8060c169d8,81) at vn_lock+0x6c sys/kern/vfs_vnops.c:575 uvn_get(fffffd80627f3ac8,0,ffff8000222e59e8,ffff8000222e5984,0,1) at uvn_get+0x276 uvm_vnode_lock sys/uvm/uvm_vnode.c:1499 [inline] uvn_get(fffffd80627f3ac8,0,ffff8000222e59e8,ffff8000222e5984,0,1) at uvn_get+0x276 sys/uvm/uvm_vnode.c:993 uvm_fault(fffffd807effa450,20ffc000,2,1) at uvm_fault+0xa41 sys/uvm/uvm_fault.c:1073 uvm_fault_wire(fffffd807effa450,20ffc000,20ffe000,1) at uvm_fault_wire+0x63 sys/uvm/uvm_fault.c:1342 uvm_map_pageable_wire(fffffd807effa450,fffffd8066b468f0,fffffd8066b46650,20f,ffffffff8235a62e,0) at uvm_map_pageable_wire+0x30d sys/uvm/uvm_map.c:2367 sys_mlock(ffff800021283208,ffff8000222e5bc8,ffff8000222e5c10) at sys_mlock+0x180 sys/uvm/uvm_mmap.c:772 syscall(ffff8000222e5c90) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000222e5c90) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:590 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xfe2725aaa30, count: -13