witness: lock order reversal: 1st 0xfffffd807effaa28 vmmaplk (&map->lock) 2nd 0xfffffd8069ffea28 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{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(fffffd8069ffea28,9,0) at witness_checkorder+0xf5a witness_debugger sys/kern/subr_witness.c:2490 [inline] witness_checkorder(fffffd8069ffea28,9,0) at witness_checkorder+0xf5a sys/kern/subr_witness.c:1087 rw_enter(fffffd8069ffea18,81) at rw_enter+0xd4 rrw_enter(fffffd8069ffea18,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:462 VOP_LOCK(fffffd8065d8c770,81) at VOP_LOCK+0x4b sys/kern/vfs_vops.c:614 vn_lock(fffffd8065d8c770,81) at vn_lock+0x6c sys/kern/vfs_vnops.c:575 uvn_get(fffffd806986a5e8,0,ffff8000256ee5a8,ffff8000256ee544,0,1) at uvn_get+0x276 uvm_vnode_lock sys/uvm/uvm_vnode.c:1499 [inline] uvn_get(fffffd806986a5e8,0,ffff8000256ee5a8,ffff8000256ee544,0,1) at uvn_get+0x276 sys/uvm/uvm_vnode.c:993 uvm_fault(fffffd807effaa10,20ff3000,2,1) at uvm_fault+0xa41 sys/uvm/uvm_fault.c:1073 uvm_fault_wire(fffffd807effaa10,20ff3000,20ff4000,1) at uvm_fault_wire+0x63 sys/uvm/uvm_fault.c:1342 uvm_map_pageable_wire(fffffd807effaa10,fffffd8065d86690,fffffd8065d86bd0,383,ffffffff81ef6f2e,0) at uvm_map_pageable_wire+0x30d sys/uvm/uvm_map.c:2367 sys_mlock(ffff8000ffff4a58,ffff8000256ee788,ffff8000256ee7d0) at sys_mlock+0x180 sys/uvm/uvm_mmap.c:772 syscall(ffff8000256ee850) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000256ee850) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:590 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xa15d45b4320, count: -13 ddb{0}> show registers rdi 0x3 rsi 0x40000 acpi_pdirpa+0x2be68 rbp 0xffff8000256ee080 rbx 0x3 rdx 0xffff800000aee180 rcx 0x3 rax 0x3ffff acpi_pdirpa+0x2be67 r8 0xffffffff81ef4bd3 witness_checkorder+0xf33 r9 0x5 r10 0x4e745cadbb949d8b r11 0xde501e59a051078 r12 0xffffffff82878ae0 w_lodata+0x53f60 r13 0 r14 0xffffffff8286ef80 w_lodata+0x4a400 r15 0xfffffd8002c96500 rip 0xffffffff8180f028 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff8000256ee070 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.0) pid=393810 stat=onproc flags process=10 proc=4000000 pri=32, usrpri=76, nice=20 forw=0xffffffffffffffff, list=0xffff8000ffff5728,0xffffffff8288b278 process=0xffff8000ffff2d78 user=0xffff8000256e9000, vmspace=0xfffffd807effaa10 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 9071 19868 52808 32767 7 0x10 syz-executor.0 * 9071 393810 52808 32767 7 0x4000010 syz-executor.0 5899 351310 0 0 3 0x14200 bored sosplice 39283 115704 77310 32767 3 0x90 piperd syz-executor.1 52808 421297 88051 32767 3 0x90 nanosleep syz-executor.0 77310 142277 4372 0 3 0x82 wait syz-executor.1 88051 131560 4372 0 3 0x82 wait syz-executor.0 4372 251965 3176 0 3 0x82 thrsleep syz-fuzzer 4372 453624 3176 0 3 0x4000082 thrsleep syz-fuzzer 4372 255315 3176 0 3 0x4000082 thrsleep syz-fuzzer 4372 26396 3176 0 3 0x4000082 thrsleep syz-fuzzer 4372 376277 3176 0 3 0x4000082 thrsleep syz-fuzzer 4372 446703 3176 0 3 0x4000082 thrsleep syz-fuzzer 4372 306415 3176 0 3 0x4000082 thrsleep syz-fuzzer 4372 135474 3176 0 3 0x4000082 kqread syz-fuzzer 3176 263731 50313 0 3 0x10008a pause ksh 50313 85299 5035 0 3 0x92 select sshd 71209 512596 1 0 3 0x100083 ttyin getty 5035 470296 1 0 3 0x80 select sshd 970 427771 12905 73 3 0x100090 kqread syslogd 12905 119032 1 0 3 0x100082 netio syslogd 24174 491871 1 77 3 0x100090 poll dhclient 24612 147450 1 0 3 0x80 poll dhclient 17660 291308 0 0 3 0x14200 bored smr 29844 409033 0 0 3 0x14200 pgzero zerothread 44695 513024 0 0 3 0x14200 aiodoned aiodoned 18665 295252 0 0 3 0x14200 syncer update 53862 3901 0 0 3 0x14200 cleaner cleaner 68806 88363 0 0 3 0x14200 reaper reaper 74740 476476 0 0 3 0x14200 pgdaemon pagedaemon 88050 207925 0 0 3 0x14200 bored crynlk 4366 423308 0 0 3 0x14200 bored crypto 48379 366164 0 0 3 0x14200 bored viomb 62278 81320 0 0 3 0x40014200 acpi0 acpi0 39487 175094 0 0 3 0x40014200 idle1 66768 350025 0 0 3 0x14200 bored softnet 56987 381784 0 0 3 0x14200 bored systqmp 64131 285512 0 0 3 0x14200 bored systq 5311 348386 0 0 3 0x40014200 bored softclock 10028 51412 0 0 3 0x40014200 idle0 1 320532 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 9071 (syz-executor.0) thread 0xffff8000ffff4a58 (393810) shared rwlock vmmaplk r = 0 (0xfffffd807effaa28) #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 (0xffffffff828a4a98) #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{0}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 9478 6349K 6349K 78643K 10569 0 pcb 13 8K 8K 78643K 13 0 rtable 105 3K 3K 78643K 221 0 ifaddr 39 10K 10K 78643K 39 0 counters 43 33K 33K 78643K 43 0 ioctlops 0 0K 2K 78643K 24 0 iov 0 0K 16K 78643K 24 0 mount 1 1K 1K 78643K 1 0 vnodes 1216 76K 77K 78643K 1242 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 12 0K 0K 78643K 193 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1825 197K 290K 78643K 13109 0 file desc 7 21K 33K 78643K 910 0 sigio 0 0K 0K 78643K 8 0 proc 48 50K 83K 78643K 428 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 116 0 in_multi 33 2K 2K 78643K 56 0 ether_multi 1 0K 0K 78643K 5 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 43 201K 201K 78643K 43 0 exec 0 0K 2K 78643K 319 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 123 25K 26K 78643K 2865 0 UVM aobj 10 2K 2K 78643K 10 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 47 0 NDP 5 0K 0K 78643K 9 0 temp 100 3961K 4025K 78643K 3618 0 kqueue 3 4K 12K 78643K 90 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 120 70 0 68 1 0 1 1 0 8 0 rtentry 112 46 0 2 2 0 2 2 0 8 0 unpcb 120 291 0 283 1 0 1 1 0 8 0 syncache 296 18 0 18 3 2 1 1 0 8 1 tcpqe 32 96 0 96 3 2 1 1 0 8 1 tcpcb 736 266 0 262 9 5 4 4 0 8 3 ipq 40 1 0 1 1 1 0 1 0 8 0 ipqe 40 5 0 5 1 1 0 1 0 8 0 inpcb 296 582 0 575 4 2 2 2 0 8 1 nd6 48 7 0 1 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 191 0 2 12 0 12 12 0 8 0 art_table 32 192 0 2 2 0 2 2 0 8 0 art_node 16 45 0 5 1 0 1 1 0 8 0 semapl 112 191 0 181 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 2413 0 1016 88 0 88 88 0 8 0 ffsino 272 2413 0 1016 94 0 94 94 0 8 0 nchpl 144 3662 0 2065 60 0 60 60 0 8 0 uvmvnodes 72 2456 0 0 45 0 45 45 0 8 0 vnodes 208 2456 0 0 130 0 130 130 0 8 0 namei 1024 9222 0 9222 1 0 1 1 0 8 1 percpumem 16 32 0 0 1 0 1 1 0 8 0 scxspl 216 10588 0 10588 9 8 1 8 0 8 1 plimitpl 152 106 0 97 1 0 1 1 0 8 0 sigapl 424 1099 0 1066 4 0 4 4 0 8 0 futexpl 56 8349 0 8349 1 0 1 1 0 8 1 knotepl 112 156 0 136 1 0 1 1 0 8 0 kqueuepl 152 655 0 653 1 0 1 1 0 8 0 pipepl 304 121 0 110 3 2 1 2 0 8 0 fdescpl 496 1082 0 1066 3 0 3 3 0 8 0 filepl 152 4543 0 4443 6 1 5 5 0 8 1 lockfpl 104 66 0 65 1 0 1 1 0 8 0 lockfspl 48 33 0 32 1 0 1 1 0 8 0 sessionpl 144 17 0 7 1 0 1 1 0 8 0 pgrppl 48 17 0 7 1 0 1 1 0 8 0 ucredpl 96 729 0 720 1 0 1 1 0 8 0 zombiepl 144 1066 0 1066 1 0 1 1 0 8 1 processpl 1056 1099 0 1066 4 1 3 3 0 8 0 procpl 656 2305 0 2264 6 1 5 5 0 8 1 sosppl 168 21 0 21 2 2 0 1 0 8 0 sockpl 400 948 0 931 5 2 3 3 0 8 1 mcl64k 65536 9 0 0 2 0 2 2 0 8 0 mcl16k 16384 2 0 0 1 0 1 1 0 8 0 mcl12k 12288 7 0 0 1 0 1 1 0 8 0 mcl9k 9216 5 0 0 1 0 1 1 0 8 0 mcl8k 8192 7 0 0 1 0 1 1 0 8 0 mcl4k 4096 15 0 0 2 0 2 2 0 8 0 mcl2k 2048 172 0 0 19 0 19 19 0 8 0 mtagpl 96 1 0 0 1 0 1 1 0 8 0 mbufpl 256 1043 0 0 63 0 63 63 0 8 0 bufpl 280 4340 0 173 298 0 298 298 0 8 0 anonpl 16 100919 0 92674 53 12 41 51 0 124 6 amapchunkpl 152 4524 0 4261 13 2 11 11 0 158 0 amappl16 192 2965 0 2699 26 12 14 26 0 8 0 amappl15 184 438 0 436 1 0 1 1 0 8 0 amappl14 176 25 0 20 1 0 1 1 0 8 0 amappl13 168 29 0 28 1 0 1 1 0 8 0 amappl12 160 4 0 1 1 0 1 1 0 8 0 amappl11 152 45 0 36 1 0 1 1 0 8 0 amappl10 144 451 0 444 1 0 1 1 0 8 0 amappl9 136 21 0 20 1 0 1 1 0 8 0 amappl8 128 143 0 101 2 0 2 2 0 8 0 amappl7 120 217 0 209 1 0 1 1 0 8 0 amappl6 112 510 0 499 1 0 1 1 0 8 0 amappl5 104 1919 0 1900 1 0 1 1 0 8 0 amappl4 96 259 0 234 1 0 1 1 0 8 0 amappl3 88 136 0 127 1 0 1 1 0 8 0 amappl2 80 7005 0 6943 2 0 2 2 0 8 0 amappl1 72 43072 0 42589 23 12 11 18 0 8 1 amappl 80 2544 0 2480 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 9 0 0 1 0 1 1 0 8 0 uaddrrnd 24 1082 0 1066 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 1082 0 1066 1 0 1 1 0 8 0 vmmpekpl 168 10272 0 10252 2 0 2 2 0 8 0 vmmpepl 168 148087 0 146511 90 13 77 84 0 357 3 vmsppl 368 1081 0 1066 2 0 2 2 0 8 0 pdppl 4096 2171 0 2132 55 14 41 45 0 8 2 pvpl 32 382824 0 371437 158 36 122 132 0 265 26 pmappl 232 1081 0 1066 2 1 1 2 0 8 0 extentpl 40 57 0 39 1 0 1 1 0 8 0 phpool 112 361 0 23 10 0 10 10 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(fffffd8069ffea28,9,0) at witness_checkorder+0xf5a witness_debugger sys/kern/subr_witness.c:2490 [inline] witness_checkorder(fffffd8069ffea28,9,0) at witness_checkorder+0xf5a sys/kern/subr_witness.c:1087 rw_enter(fffffd8069ffea18,81) at rw_enter+0xd4 rrw_enter(fffffd8069ffea18,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:462 VOP_LOCK(fffffd8065d8c770,81) at VOP_LOCK+0x4b sys/kern/vfs_vops.c:614 vn_lock(fffffd8065d8c770,81) at vn_lock+0x6c sys/kern/vfs_vnops.c:575 uvn_get(fffffd806986a5e8,0,ffff8000256ee5a8,ffff8000256ee544,0,1) at uvn_get+0x276 uvm_vnode_lock sys/uvm/uvm_vnode.c:1499 [inline] uvn_get(fffffd806986a5e8,0,ffff8000256ee5a8,ffff8000256ee544,0,1) at uvn_get+0x276 sys/uvm/uvm_vnode.c:993 uvm_fault(fffffd807effaa10,20ff3000,2,1) at uvm_fault+0xa41 sys/uvm/uvm_fault.c:1073 uvm_fault_wire(fffffd807effaa10,20ff3000,20ff4000,1) at uvm_fault_wire+0x63 sys/uvm/uvm_fault.c:1342 uvm_map_pageable_wire(fffffd807effaa10,fffffd8065d86690,fffffd8065d86bd0,383,ffffffff81ef6f2e,0) at uvm_map_pageable_wire+0x30d sys/uvm/uvm_map.c:2367 sys_mlock(ffff8000ffff4a58,ffff8000256ee788,ffff8000256ee7d0) at sys_mlock+0x180 sys/uvm/uvm_mmap.c:772 syscall(ffff8000256ee850) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000256ee850) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:590 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xa15d45b4320, count: -13 ddb{0}> machine ddbcpu 1 Stopped at x86_ipi_db+0x1a: addq $0x8,%rsp ddb{1}> trace x86_ipi_db(ffff800020d78ff0) 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+0x7 sys/dev/kcov.c:139 upageflttrap(ffff8000256d8e30,a15c6b4c0b0) at upageflttrap+0x77 sys/arch/amd64/amd64/trap.c:180 usertrap(ffff8000256d8e30) at usertrap+0x21a sys/arch/amd64/amd64/trap.c:406 recall_trap() at recall_trap+0x8 end of kernel end trace frame: 0x7f7fffff6aa0, count: -7