witness: lock order reversal: 1st 0xfffffd8008462a28 vmmaplk (&map->lock) 2nd 0xfffffd806598a2c0 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+0x210 sys/arch/amd64/amd64/trap.c:267 #6 kerntrap+0xef sys/arch/amd64/amd64/trap.c:322 #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:591 #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_io+0x2b5 sys/uvm/uvm_vnode.c:1201 #6 uvn_get+0x236 sys/uvm/uvm_vnode.c:1061 #7 uvm_fault+0xa41 sys/uvm/uvm_fault.c:1073 #8 uvm_fault_wire+0x63 sys/uvm/uvm_fault.c:1342 #9 uvm_map_pageable_wire+0x30d sys/uvm/uvm_map.c:2367 #10 sys_mlock+0x180 sys/uvm/uvm_mmap.c:772 #11 syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] #11 syscall+0x4a1 sys/arch/amd64/amd64/trap.c:591 #12 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(fffffd806598a2c0,9,0) at witness_checkorder+0xf5a witness_debugger sys/kern/subr_witness.c:2490 [inline] witness_checkorder(fffffd806598a2c0,9,0) at witness_checkorder+0xf5a sys/kern/subr_witness.c:1087 rw_enter(fffffd806598a2b0,81) at rw_enter+0xd4 rrw_enter(fffffd806598a2b0,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:462 VOP_LOCK(fffffd8061c69c50,81) at VOP_LOCK+0x4b sys/kern/vfs_vops.c:614 vn_lock(fffffd8061c69c50,81) at vn_lock+0x6c sys/kern/vfs_vnops.c:575 uvn_io(fffffd8061d1d450,ffff8000212e76c8,1,2,0) at uvn_io+0x2b5 sys/uvm/uvm_vnode.c:1201 uvn_get(fffffd8061d1d450,0,ffff8000212e7928,ffff8000212e78c4,0,5) at uvn_get+0x236 sys/uvm/uvm_vnode.c:1061 uvm_fault(fffffd8008462a10,20000000,2,5) at uvm_fault+0xa41 sys/uvm/uvm_fault.c:1073 uvm_fault_wire(fffffd8008462a10,20000000,20004000,5) at uvm_fault_wire+0x63 sys/uvm/uvm_fault.c:1342 uvm_map_pageable_wire(fffffd8008462a10,fffffd806597cb58,fffffd806597cca8,241,ffffffff8137390e,0) at uvm_map_pageable_wire+0x30d sys/uvm/uvm_map.c:2367 sys_mlock(ffff8000212b9730,ffff8000212e7b08,ffff8000212e7b50) at sys_mlock+0x180 sys/uvm/uvm_mmap.c:772 syscall(ffff8000212e7bd0) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000212e7bd0) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:591 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xb2139e726a0, count: -14 ddb{1}> show registers rdi 0x3 rsi 0x40000 acpi_pdirpa+0x2be68 rbp 0xffff8000212e7320 rbx 0x3 rdx 0xffff800000af5780 rcx 0x3 rax 0x3ffff acpi_pdirpa+0x2be67 r8 0xffffffff813715b3 witness_checkorder+0xf33 r9 0x5 r10 0x1c691ed2c723dd9f r11 0x99a0f1ac714f8a33 r12 0xffffffff82825f20 w_lodata+0x54430 r13 0 r14 0xffffffff8281f800 w_lodata+0x4dd10 r15 0xfffffd8002c99500 rip 0xffffffff81747758 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff8000212e7310 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{1}> show proc PROC (syz-executor.0) pid=443068 stat=onproc flags process=0 proc=4000000 pri=32, usrpri=68, nice=20 forw=0xffffffffffffffff, list=0xffff8000212b8a60,0xffffffff828883a0 process=0xffff80002125d4b0 user=0xffff8000212e2000, vmspace=0xfffffd8008462a10 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND 77219 405517 34495 0 7 0 syz-executor.0 *77219 443068 34495 0 7 0x4000000 syz-executor.0 10896 97162 21756 0 3 0x82 nanosleep syz-executor.1 34495 201206 21756 0 3 0x82 nanosleep syz-executor.0 21756 126816 81832 0 3 0x82 thrsleep syz-fuzzer 21756 131696 81832 0 3 0x4000082 nanosleep syz-fuzzer 21756 399528 81832 0 3 0x4000082 thrsleep syz-fuzzer 21756 145290 81832 0 3 0x4000082 thrsleep syz-fuzzer 21756 445246 81832 0 3 0x4000082 thrsleep syz-fuzzer 21756 438757 81832 0 3 0x4000082 thrsleep syz-fuzzer 21756 10906 81832 0 3 0x4000082 kqread syz-fuzzer 21756 102422 81832 0 3 0x4000082 thrsleep syz-fuzzer 81832 202547 23717 0 3 0x10008a pause ksh 23717 476181 17902 0 3 0x92 select sshd 8159 259876 1 0 3 0x100083 ttyin getty 17902 487176 1 0 3 0x80 select sshd 42465 89668 20135 74 3 0x100092 bpf pflogd 20135 191143 1 0 3 0x80 netio pflogd 41963 336085 90209 73 3 0x100090 kqread syslogd 90209 106636 1 0 3 0x100082 netio syslogd 64082 92709 1 77 3 0x100090 poll dhclient 48243 2606 1 0 3 0x80 poll dhclient 29402 87368 0 0 3 0x14200 bored smr 60180 77591 0 0 3 0x14200 pgzero zerothread 81057 491992 0 0 3 0x14200 aiodoned aiodoned 24196 367999 0 0 3 0x14200 syncer update 59266 344931 0 0 3 0x14200 cleaner cleaner 43915 497612 0 0 3 0x14200 reaper reaper 92974 502628 0 0 3 0x14200 pgdaemon pagedaemon 78475 245692 0 0 3 0x14200 bored crynlk 59649 258747 0 0 3 0x14200 bored crypto 15716 47838 0 0 3 0x14200 bored viomb 49973 334997 0 0 3 0x40014200 acpi0 acpi0 10346 405242 0 0 3 0x40014200 idle1 5401 222970 0 0 3 0x14200 bored softnet 70475 236324 0 0 3 0x14200 bored systqmp 59653 268662 0 0 3 0x14200 bored systq 59928 182951 0 0 3 0x40014200 bored softclock 57622 481758 0 0 3 0x40014200 idle0 1 267085 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{1}> show all locks Process 77219 (syz-executor.0) thread 0xffff8000212b9730 (443068) shared rwlock vmmaplk r = 0 (0xfffffd8008462a28) #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:591 #6 Xsyscall+0x128 exclusive kernel_lock &kernel_lock r = 0 (0xffffffff82884200) #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:591 #2 Xsyscall+0x128 ddb{1}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 9505 6738K 7006K 78643K 10680 0 pcb 14 8K 8K 78643K 18 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 1469 0 iov 0 0K 12K 78643K 4 0 mount 1 1K 1K 78643K 1 0 vnodes 1227 77K 77K 78643K 1248 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 5K 78643K 3 0 VM map 2 1K 1K 78643K 2 0 sem 2 0K 0K 78643K 2 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1825 197K 290K 78643K 13109 0 file desc 5 13K 25K 78643K 55 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 4 0 in_multi 33 2K 2K 78643K 34 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 362 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 183 28K 28K 78643K 923 0 UVM aobj 6 2K 2K 78643K 9 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 NDP 6 0K 0K 78643K 10 0 temp 72 3953K 4016K 78643K 5596 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 19 0 17 1 0 1 1 0 8 0 rtentry 112 45 0 1 2 0 2 2 0 8 0 unpcb 120 33 0 23 1 0 1 1 0 8 0 syncache 296 4 0 4 1 1 0 1 0 8 0 tcpqe 32 223 0 223 1 1 0 1 0 8 0 tcpcb 736 10 0 6 1 0 1 1 0 8 0 inpcb 296 42 0 34 1 0 1 1 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 12 0 2 1 0 1 1 0 8 0 pfstkey 112 12 0 2 1 0 1 1 0 8 0 pfstate 328 12 0 2 1 0 1 1 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 sysvmsgpl 40 2 0 0 1 0 1 1 0 8 0 shmpl 112 6 0 3 1 0 1 1 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 1448 0 43 88 0 88 88 0 8 0 ffsino 272 1448 0 43 95 1 94 94 0 8 0 nchpl 144 1692 0 87 60 0 60 60 0 8 0 uvmvnodes 72 1518 0 0 28 0 28 28 0 8 0 vnodes 208 1518 0 0 80 0 80 80 0 8 0 namei 1024 4432 0 4432 2 1 1 1 0 8 1 percpumem 16 32 0 0 1 0 1 1 0 8 0 scxspl 216 5153 0 5153 9 8 1 8 0 8 1 plimitpl 152 17 0 9 1 0 1 1 0 8 0 sigapl 424 271 0 239 4 0 4 4 0 8 0 futexpl 56 357 0 357 1 0 1 1 0 8 1 knotepl 112 62 0 42 1 0 1 1 0 8 0 kqueuepl 152 27 0 24 1 0 1 1 0 8 0 pipepl 304 80 0 69 2 0 2 2 0 8 1 fdescpl 496 255 0 239 3 0 3 3 0 8 0 filepl 152 1234 0 1129 6 1 5 5 0 8 0 lockfpl 104 18 0 16 1 0 1 1 0 8 0 lockfspl 48 9 0 7 1 0 1 1 0 8 0 sessionpl 144 18 0 7 1 0 1 1 0 8 0 pgrppl 48 18 0 7 1 0 1 1 0 8 0 ucredpl 96 62 0 53 1 0 1 1 0 8 0 zombiepl 144 239 0 238 2 1 1 1 0 8 0 processpl 1056 271 0 238 3 0 3 3 0 8 0 procpl 656 320 0 279 5 1 4 4 0 8 0 sockpl 400 94 0 74 4 1 3 3 0 8 1 mcl16k 16384 1 0 0 1 0 1 1 0 8 0 mcl4k 4096 3 0 0 1 0 1 1 0 8 0 mcl2k 2048 189 0 0 23 0 23 23 0 8 0 mtagpl 96 11 0 0 1 0 1 1 0 8 0 mbufpl 256 218 0 0 13 0 13 13 0 8 0 bufpl 280 3561 0 181 242 0 242 242 0 8 0 anonpl 16 52529 0 24608 114 1 113 113 0 124 0 amapchunkpl 152 1876 0 1053 33 0 33 33 0 158 1 amappl16 192 1124 0 182 48 0 48 48 0 8 0 amappl15 184 4 0 2 1 0 1 1 0 8 0 amappl14 176 22 0 18 1 0 1 1 0 8 0 amappl13 168 45 0 41 1 0 1 1 0 8 0 amappl12 160 15 0 13 1 0 1 1 0 8 0 amappl11 152 54 0 38 1 0 1 1 0 8 0 amappl10 144 10 0 7 1 0 1 1 0 8 0 amappl9 136 378 0 376 2 1 1 1 0 8 0 amappl8 128 138 0 104 2 0 2 2 0 8 0 amappl7 120 261 0 252 1 0 1 1 0 8 0 amappl6 112 70 0 59 1 0 1 1 0 8 0 amappl5 104 385 0 367 1 0 1 1 0 8 0 amappl4 96 283 0 256 1 0 1 1 0 8 0 amappl3 88 147 0 138 1 0 1 1 0 8 0 amappl2 80 1130 0 1062 3 1 2 3 0 8 0 amappl1 72 16362 0 15880 27 16 11 19 0 8 2 amappl 80 673 0 535 3 0 3 3 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 8 0 3 1 0 1 1 0 8 0 uaddrrnd 24 255 0 239 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 255 0 239 1 0 1 1 0 8 0 vmmpekpl 168 6142 0 6115 2 0 2 2 0 8 0 vmmpepl 168 40613 0 38377 143 12 131 131 0 357 33 vmsppl 368 254 0 239 2 0 2 2 0 8 0 pdppl 4096 517 0 478 7 1 6 6 0 8 1 pvpl 32 154962 0 123646 254 0 254 254 0 265 1 pmappl 232 254 0 239 2 0 2 2 0 8 1 extentpl 40 57 0 39 1 0 1 1 0 8 0 phpool 112 258 0 7 8 0 8 8 0 8 0 ddb{1}> machine ddbcpu 0 Stopped at x86_ipi_db+0x1a: addq $0x8,%rsp ddb{0}> trace x86_ipi_db(ffffffff82778ff0) 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 __sanitizer_cov_trace_pc() at __sanitizer_cov_trace_pc+0xf kd_curproc sys/dev/kcov.c:559 [inline] __sanitizer_cov_trace_pc() at __sanitizer_cov_trace_pc+0xf sys/dev/kcov.c:143 __mp_lock(ffffffff82883ff8) at __mp_lock+0x133 __mp_lock_spin sys/kern/kern_lock.c:116 [inline] __mp_lock(ffffffff82883ff8) at __mp_lock+0x133 sys/kern/kern_lock.c:147 intr_handler(ffff8000234f5280,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+0xb sys/dev/kcov.c:139 softintr_dispatch(0) at softintr_dispatch+0x4e sys/arch/amd64/amd64/softintr.c:90 Xsoftclock() at Xsoftclock+0x1f end of kernel end trace frame: 0x7f7ffffbd250, count: -10 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(fffffd806598a2c0,9,0) at witness_checkorder+0xf5a witness_debugger sys/kern/subr_witness.c:2490 [inline] witness_checkorder(fffffd806598a2c0,9,0) at witness_checkorder+0xf5a sys/kern/subr_witness.c:1087 rw_enter(fffffd806598a2b0,81) at rw_enter+0xd4 rrw_enter(fffffd806598a2b0,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:462 VOP_LOCK(fffffd8061c69c50,81) at VOP_LOCK+0x4b sys/kern/vfs_vops.c:614 vn_lock(fffffd8061c69c50,81) at vn_lock+0x6c sys/kern/vfs_vnops.c:575 uvn_io(fffffd8061d1d450,ffff8000212e76c8,1,2,0) at uvn_io+0x2b5 sys/uvm/uvm_vnode.c:1201 uvn_get(fffffd8061d1d450,0,ffff8000212e7928,ffff8000212e78c4,0,5) at uvn_get+0x236 sys/uvm/uvm_vnode.c:1061 uvm_fault(fffffd8008462a10,20000000,2,5) at uvm_fault+0xa41 sys/uvm/uvm_fault.c:1073 uvm_fault_wire(fffffd8008462a10,20000000,20004000,5) at uvm_fault_wire+0x63 sys/uvm/uvm_fault.c:1342 uvm_map_pageable_wire(fffffd8008462a10,fffffd806597cb58,fffffd806597cca8,241,ffffffff8137390e,0) at uvm_map_pageable_wire+0x30d sys/uvm/uvm_map.c:2367 sys_mlock(ffff8000212b9730,ffff8000212e7b08,ffff8000212e7b50) at sys_mlock+0x180 sys/uvm/uvm_mmap.c:772 syscall(ffff8000212e7bd0) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000212e7bd0) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:591 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xb2139e726a0, count: -14