witness: lock order reversal: 1st 0xfffffd807effeb98 vmmaplk (&map->lock) 2nd 0xfffffd80347da6f8 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:1438 #3 uvm_fault+0x7e sys/uvm/uvm_fault.c:526 #4 kpageflttrap+0x210 sys/arch/amd64/amd64/trap.c:268 #5 kerntrap+0xef sys/arch/amd64/amd64/trap.c:323 #6 alltraps_kern_meltdown+0x7b #7 copyout+0x53 #8 ffs_read+0x3e2 sys/ufs/ffs/ffs_vnops.c:258 #9 VOP_READ+0xbf sys/kern/vfs_vops.c:253 #10 vn_rdwr+0x10b #11 vmcmd_map_readvn+0xda sys/kern/exec_subr.c:246 #12 exec_process_vmcmds+0xb2 sys/kern/exec_subr.c:143 #13 sys_execve+0x9ff sys/kern/kern_exec.c:461 #14 syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] #14 syscall+0x4a1 sys/arch/amd64/amd64/trap.c:589 #15 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:1196 #6 uvn_get+0x226 sys/uvm/uvm_vnode.c:1056 #7 uvm_fault+0x1197 sys/uvm/uvm_fault.c:1016 #8 uvm_fault_wire+0x63 sys/uvm/uvm_fault.c:1285 #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:589 #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(fffffd80347da6f8,9,0) at witness_checkorder+0xf5a witness_debugger sys/kern/subr_witness.c:2490 [inline] witness_checkorder(fffffd80347da6f8,9,0) at witness_checkorder+0xf5a sys/kern/subr_witness.c:1087 rw_enter(fffffd80347da6e8,81) at rw_enter+0xd4 rrw_enter(fffffd80347da6e8,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:462 VOP_LOCK(fffffd804949a828,81) at VOP_LOCK+0x4b sys/kern/vfs_vops.c:614 vn_lock(fffffd804949a828,81) at vn_lock+0x6c sys/kern/vfs_vnops.c:575 uvn_io(fffffd80497665b8,ffff800025723b98,1,2,0) at uvn_io+0x2b5 sys/uvm/uvm_vnode.c:1196 uvn_get(fffffd80497665b8,0,ffff800025723df0,ffff800025723d8c,0,5) at uvn_get+0x226 sys/uvm/uvm_vnode.c:1056 uvm_fault(fffffd807effeb80,20ffc000,2,5) at uvm_fault+0x1197 sys/uvm/uvm_fault.c:1016 uvm_fault_wire(fffffd807effeb80,20ffc000,20ffe000,5) at uvm_fault_wire+0x63 sys/uvm/uvm_fault.c:1285 uvm_map_pageable_wire(fffffd807effeb80,fffffd8050d77408,fffffd8050d778a0,35c,ffffffff81a80d0e,0) at uvm_map_pageable_wire+0x30d sys/uvm/uvm_map.c:2367 sys_mlock(ffff8000ffffa9f8,ffff800025723fd8,ffff800025724020) at sys_mlock+0x180 sys/uvm/uvm_mmap.c:772 syscall(ffff8000257240a0) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000257240a0) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:589 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x2de5da97b00, count: -14 ddb{0}> show registers rdi 0x3 rsi 0x40000 acpi_pdirpa+0x2be68 rbp 0xffff8000257237f0 rbx 0x3 rdx 0xffff800000af7e00 rcx 0x3 rax 0x3ffff acpi_pdirpa+0x2be67 r8 0xffffffff81a7e9b3 witness_checkorder+0xf33 r9 0x5 r10 0xb4d31471250ddb13 r11 0x142ffd1cf30814db r12 0xffffffff8284c210 w_lodata+0x54590 r13 0 r14 0xffffffff82838940 w_lodata+0x40cc0 r15 0xfffffd8002c8f480 rip 0xffffffff82156c28 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff8000257237e0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.0) pid=245077 stat=onproc flags process=10 proc=4000000 pri=32, usrpri=78, nice=20 forw=0xffffffffffffffff, list=0xffff8000ffffa290,0xffffffff82893e08 process=0xffff80002124cbd0 user=0xffff80002571f000, vmspace=0xfffffd807effeb80 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 43385 20229 90187 32767 7 0x10 syz-executor.0 *43385 245077 90187 32767 7 0x4000010 syz-executor.0 24986 510336 0 0 3 0x14200 bored sosplice 68215 441732 82936 32767 3 0x90 nanosleep syz-executor.1 90187 411202 79053 32767 3 0x90 nanosleep syz-executor.0 82936 71230 41499 0 3 0x82 wait syz-executor.1 79053 401421 41499 0 3 0x82 wait syz-executor.0 41499 328642 74976 0 3 0x82 thrsleep syz-fuzzer 41499 382883 74976 0 3 0x4000082 nanosleep syz-fuzzer 41499 478433 74976 0 3 0x4000082 thrsleep syz-fuzzer 41499 460777 74976 0 3 0x4000082 thrsleep syz-fuzzer 41499 11540 74976 0 3 0x4000082 thrsleep syz-fuzzer 41499 487891 74976 0 3 0x4000082 thrsleep syz-fuzzer 41499 425407 74976 0 3 0x4000082 thrsleep syz-fuzzer 41499 442746 74976 0 3 0x4000082 kqread syz-fuzzer 74976 279626 4729 0 3 0x10008a pause ksh 4729 513267 71486 0 3 0x92 select sshd 66566 437384 1 0 3 0x100083 ttyin getty 71486 47111 1 0 3 0x80 select sshd 81411 127315 94179 73 3 0x100090 kqread syslogd 94179 460184 1 0 3 0x100082 netio syslogd 74147 99831 1 77 3 0x100090 poll dhclient 1248 521129 1 0 3 0x80 poll dhclient 97226 16834 0 0 3 0x14200 bored smr 50765 444867 0 0 3 0x14200 pgzero zerothread 4482 263608 0 0 3 0x14200 aiodoned aiodoned 88343 484316 0 0 3 0x14200 syncer update 3224 80302 0 0 3 0x14200 cleaner cleaner 15238 352221 0 0 3 0x14200 reaper reaper 65743 24709 0 0 3 0x14200 pgdaemon pagedaemon 54431 519253 0 0 3 0x14200 bored crynlk 44491 205230 0 0 3 0x14200 bored crypto 32452 252308 0 0 3 0x40014200 acpi0 acpi0 71415 110651 0 0 3 0x40014200 idle1 99762 126196 0 0 3 0x14200 bored softnet 15003 419365 0 0 3 0x14200 bored systqmp 18951 70300 0 0 3 0x14200 bored systq 85477 470425 0 0 3 0x40014200 bored softclock 8614 371682 0 0 3 0x40014200 idle0 1 374716 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 43385 (syz-executor.0) thread 0xffff8000ffffa9f8 (245077) shared rwlock vmmaplk r = 0 (0xfffffd807effeb98) #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:5452 #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:589 #6 Xsyscall+0x128 exclusive kernel_lock &kernel_lock r = 0 (0xffffffff82892098) #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:589 #2 Xsyscall+0x128 ddb{0}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 9464 6330K 6330K 78643K 10556 0 pcb 13 8K 8K 78643K 13 0 rtable 105 3K 3K 78643K 190 0 ifaddr 39 10K 10K 78643K 39 0 counters 43 33K 33K 78643K 43 0 ioctlops 0 0K 2K 78643K 9071 0 iov 0 0K 2K 78643K 1272 0 mount 1 1K 1K 78643K 1 0 vnodes 1216 76K 76K 78643K 1225 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 5K 78643K 20 0 VM map 2 1K 1K 78643K 2 0 sem 12 1K 1K 78643K 111 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1824 197K 290K 78643K 13058 0 file desc 7 21K 33K 78643K 63251 0 sigio 0 0K 0K 78643K 9 0 proc 48 50K 83K 78643K 392 0 subproc 34 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 33 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 37 175K 175K 78643K 37 0 exec 0 0K 2K 78643K 332 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 988 105K 114K 78643K 138146 0 UVM aobj 51 2K 2K 78643K 55 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 4 0 NDP 5 0K 0K 78643K 9 0 temp 102 3965K 4029K 78643K 128314 0 kqueue 3 4K 9K 78643K 49 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 96 24 0 22 1 0 1 1 0 8 0 rtentry 112 45 0 1 2 0 2 2 0 8 0 unpcb 120 28797 0 28789 1 0 1 1 0 8 0 syncache 272 4 0 4 1 1 0 1 0 8 0 sackhl 24 2 0 2 2 2 0 1 0 8 0 tcpqe 32 957 0 957 9 9 0 7 0 8 0 tcpcb 592 42 0 38 1 0 1 1 0 8 0 inpcb 296 84 0 77 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 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 187 0 0 12 0 12 12 0 8 0 art_table 32 188 0 0 2 0 2 2 0 8 0 art_node 16 44 0 4 1 0 1 1 0 8 0 sysvmsgpl 40 19 0 1 1 0 1 1 0 8 0 semupl 112 5 0 5 1 1 0 1 0 8 0 semapl 112 103 0 93 1 0 1 1 0 8 0 shmpl 112 52 0 4 2 0 2 2 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 64802 0 63405 88 0 88 88 0 8 0 ffsino 272 64802 0 63405 94 0 94 94 0 8 0 nchpl 144 132864 0 131266 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 278460 0 278460 4 3 1 1 0 8 1 percpumem 16 32 0 0 1 0 1 1 0 8 0 scxspl 192 385150 0 385150 16 15 1 7 0 8 1 plimitpl 152 25 0 16 1 0 1 1 0 8 0 sigapl 424 63439 0 63407 4 0 4 4 0 8 0 futexpl 56 393213 0 393213 2 1 1 1 0 8 1 knotepl 112 116 0 96 1 0 1 1 0 8 0 kqueuepl 152 107488 0 107465 4 2 2 2 0 8 0 pipepl 304 1582 0 1571 20 18 2 2 0 8 1 fdescpl 496 63423 0 63407 3 0 3 3 0 8 0 filepl 152 222726 0 222626 15 10 5 5 0 8 1 lockfpl 104 284 0 282 1 0 1 1 0 8 0 lockfspl 48 135 0 133 1 0 1 1 0 8 0 sessionpl 120 17 0 7 1 0 1 1 0 8 0 pgrppl 48 20 0 10 1 0 1 1 0 8 0 ucredpl 96 3624 0 3615 1 0 1 1 0 8 0 zombiepl 144 63407 0 63406 4 3 1 1 0 8 0 processpl 1008 63439 0 63406 7 2 5 5 0 8 0 procpl 632 128800 0 128759 4 0 4 4 0 8 0 sosppl 144 1 0 1 1 1 0 1 0 8 0 sockpl 400 28935 0 28918 24 21 3 4 0 8 1 mcl64k 65536 26 0 0 4 1 3 3 0 8 0 mcl16k 16384 3 0 0 1 0 1 1 0 8 0 mcl12k 12288 26 0 0 2 0 2 2 0 8 0 mcl9k 9216 18 0 0 2 0 2 2 0 8 0 mcl8k 8192 17 0 0 3 0 3 3 0 8 0 mcl4k 4096 18 0 0 3 0 3 3 0 8 0 mcl2k2 2112 7 0 0 1 0 1 1 0 8 0 mcl2k 2048 996 0 0 120 64 56 120 0 8 0 mtagpl 96 1 0 0 1 0 1 1 0 8 0 mbufpl 256 1308 0 0 61 11 50 61 0 8 0 bufpl 280 66652 0 60404 447 0 447 447 0 8 0 anonpl 16 4087709 0 3860776 1079 5 1074 1075 0 124 0 amapchunkpl 152 206139 0 201612 312 74 238 281 0 158 0 amappl16 192 136884 0 125686 562 1 561 561 0 8 1 amappl15 184 3 0 1 2 1 1 1 0 8 0 amappl14 176 27 0 19 1 0 1 1 0 8 0 amappl13 168 92 0 87 1 0 1 1 0 8 0 amappl12 160 15 0 8 1 0 1 1 0 8 0 amappl11 152 31870 0 31857 1 0 1 1 0 8 0 amappl10 144 8 0 5 1 0 1 1 0 8 0 amappl9 136 366 0 365 3 2 1 1 0 8 0 amappl8 128 159 0 108 2 0 2 2 0 8 0 amappl7 120 221 0 212 1 0 1 1 0 8 0 amappl6 112 61 0 48 1 0 1 1 0 8 0 amappl5 104 63742 0 63719 1 0 1 1 0 8 0 amappl4 96 31842 0 31813 1 0 1 1 0 8 0 amappl3 88 4175 0 4163 1 0 1 1 0 8 0 amappl2 80 440755 0 440693 2 0 2 2 0 8 0 amappl1 72 1955087 0 1954597 44 34 10 18 0 8 0 amappl 80 129902 0 128978 20 0 20 20 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 54 0 4 1 0 1 1 0 8 0 uaddrrnd 24 63423 0 63407 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 63423 0 63407 1 0 1 1 0 8 0 vmmpekpl 168 224222 0 224193 3 1 2 2 0 8 0 vmmpepl 168 8189206 0 8175795 1134 544 590 1094 0 357 1 vmsppl 368 63422 0 63407 2 0 2 2 0 8 0 pdppl 4096 126853 0 126814 8 2 6 6 0 8 1 pvpl 32 20826177 0 20596039 2193 13 2180 2185 0 265 0 pmappl 232 63422 0 63407 2 1 1 2 0 8 0 extentpl 40 53 0 36 1 0 1 1 0 8 0 phpool 112 431 0 105 12 0 12 12 0 8 0 ddb{0}> machine ddbcpu 0 Invalid cpu 0 ddb{0}> trace db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398 witness_checkorder(fffffd80347da6f8,9,0) at witness_checkorder+0xf5a witness_debugger sys/kern/subr_witness.c:2490 [inline] witness_checkorder(fffffd80347da6f8,9,0) at witness_checkorder+0xf5a sys/kern/subr_witness.c:1087 rw_enter(fffffd80347da6e8,81) at rw_enter+0xd4 rrw_enter(fffffd80347da6e8,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:462 VOP_LOCK(fffffd804949a828,81) at VOP_LOCK+0x4b sys/kern/vfs_vops.c:614 vn_lock(fffffd804949a828,81) at vn_lock+0x6c sys/kern/vfs_vnops.c:575 uvn_io(fffffd80497665b8,ffff800025723b98,1,2,0) at uvn_io+0x2b5 sys/uvm/uvm_vnode.c:1196 uvn_get(fffffd80497665b8,0,ffff800025723df0,ffff800025723d8c,0,5) at uvn_get+0x226 sys/uvm/uvm_vnode.c:1056 uvm_fault(fffffd807effeb80,20ffc000,2,5) at uvm_fault+0x1197 sys/uvm/uvm_fault.c:1016 uvm_fault_wire(fffffd807effeb80,20ffc000,20ffe000,5) at uvm_fault_wire+0x63 sys/uvm/uvm_fault.c:1285 uvm_map_pageable_wire(fffffd807effeb80,fffffd8050d77408,fffffd8050d778a0,35c,ffffffff81a80d0e,0) at uvm_map_pageable_wire+0x30d sys/uvm/uvm_map.c:2367 sys_mlock(ffff8000ffffa9f8,ffff800025723fd8,ffff800025724020) at sys_mlock+0x180 sys/uvm/uvm_mmap.c:772 syscall(ffff8000257240a0) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000257240a0) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:589 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x2de5da97b00, count: -14 ddb{0}> machine ddbcpu 1 Stopped at x86_ipi_db+0x1a: addq $0x8,%rsp ddb{1}> trace x86_ipi_db(ffff800020d80ff0) 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(ffffffff82891e90) at __mp_lock+0x129 __mp_lock_spin sys/kern/kern_lock.c:116 [inline] __mp_lock(ffffffff82891e90) at __mp_lock+0x129 sys/kern/kern_lock.c:147 sleep_setup(ffff8000234f4cd0,ffffffff8277dab8,120,ffffffff823b5398) at sleep_setup+0xcf sys/kern/kern_synch.c:373 tsleep(ffffffff8277dab8,120,ffffffff823b5398,2) at tsleep+0xdd sleep_setup_timeout sys/kern/kern_synch.c:435 [inline] tsleep(ffffffff8277dab8,120,ffffffff823b5398,2) at tsleep+0xdd sys/kern/kern_synch.c:151 sys_nanosleep(ffff8000ffffa290,ffff8000234f4e00,ffff8000234f4e50) at sys_nanosleep+0x1f5 sys/kern/kern_time.c:297 syscall(ffff8000234f4ed0) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000234f4ed0) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:589 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7fffff6fd0, count: -9