witness: lock order reversal: 1st 0xfffffd807effe8b8 vmmaplk (&map->lock) 2nd 0xfffffd805e042808 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(fffffd805e042808,9,0) at witness_checkorder+0xf5a witness_debugger sys/kern/subr_witness.c:2490 [inline] witness_checkorder(fffffd805e042808,9,0) at witness_checkorder+0xf5a sys/kern/subr_witness.c:1087 rw_enter(fffffd805e0427f8,81) at rw_enter+0xd4 rrw_enter(fffffd805e0427f8,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:462 VOP_LOCK(fffffd8062e618f8,81) at VOP_LOCK+0x4b sys/kern/vfs_vops.c:614 vn_lock(fffffd8062e618f8,81) at vn_lock+0x6c sys/kern/vfs_vnops.c:575 uvn_io(fffffd8062f51648,ffff800025705bf8,1,2,0) at uvn_io+0x2b5 sys/uvm/uvm_vnode.c:1196 uvn_get(fffffd8062f51648,0,ffff800025705e50,ffff800025705dec,0,4) at uvn_get+0x226 sys/uvm/uvm_vnode.c:1056 uvm_fault(fffffd807effe8a0,20ffb000,2,4) at uvm_fault+0x1197 sys/uvm/uvm_fault.c:1016 uvm_fault_wire(fffffd807effe8a0,20ffb000,20ffd000,4) at uvm_fault_wire+0x63 sys/uvm/uvm_fault.c:1285 uvm_map_pageable_wire(fffffd807effe8a0,fffffd80619c7c48,fffffd80619c7468,11c,0,0) at uvm_map_pageable_wire+0x30d sys/uvm/uvm_map.c:2367 sys_mlock(ffff8000226e33d8,ffff800025706038,ffff800025706080) at sys_mlock+0x180 sys/uvm/uvm_mmap.c:772 syscall(ffff800025706100) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff800025706100) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:589 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x8d2c4de24e0, count: -14 ddb{0}> show registers rdi 0x3 rsi 0x40000 acpi_pdirpa+0x2be68 rbp 0xffff800025705850 rbx 0x3 rdx 0xffff800000aedf00 rcx 0x3 rax 0x3ffff acpi_pdirpa+0x2be67 r8 0xffffffff81a7e9b3 witness_checkorder+0xf33 r9 0x5 r10 0xafae72efddb2ba2d r11 0x4eaefba015d3c400 r12 0xffffffff8284c210 w_lodata+0x54590 r13 0 r14 0xffffffff82838680 w_lodata+0x40a00 r15 0xfffffd8002c8f480 rip 0xffffffff82156c28 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800025705840 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.1) pid=432386 stat=onproc flags process=10 proc=4000000 pri=32, usrpri=80, nice=20 forw=0xffffffffffffffff, list=0xffff8000226e2018,0xffffffff82893e08 process=0xffff8000ffffc3f0 user=0xffff800025701000, vmspace=0xfffffd807effe8a0 estcpu=30, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 41138 214435 4606 32767 2 0x10 syz-executor.1 *41138 432386 4606 32767 7 0x4000010 syz-executor.1 16730 455811 38599 32767 3 0x90 piperd syz-executor.0 4606 405964 78814 32767 3 0x90 nanosleep syz-executor.1 78814 79703 52944 0 3 0x82 wait syz-executor.1 38599 85801 52944 0 3 0x82 wait syz-executor.0 52944 19586 48800 0 3 0x82 thrsleep syz-fuzzer 52944 43929 48800 0 3 0x4000082 nanosleep syz-fuzzer 52944 319555 48800 0 3 0x4000082 kqread syz-fuzzer 52944 273963 48800 0 3 0x4000082 thrsleep syz-fuzzer 52944 324763 48800 0 3 0x4000082 thrsleep syz-fuzzer 52944 115535 48800 0 3 0x4000082 thrsleep syz-fuzzer 52944 143054 48800 0 7 0x4000002 syz-fuzzer 52944 408857 48800 0 3 0x4000082 thrsleep syz-fuzzer 48800 287921 27095 0 3 0x10008a pause ksh 27095 490701 19824 0 3 0x92 select sshd 99116 29231 1 0 3 0x100083 ttyin getty 19824 267908 1 0 3 0x80 select sshd 16838 503954 30104 73 3 0x100090 kqread syslogd 30104 445165 1 0 3 0x100082 netio syslogd 9348 468793 1 77 3 0x100090 poll dhclient 93298 159895 1 0 3 0x80 poll dhclient 59590 465487 0 0 3 0x14200 bored smr 27277 168472 0 0 2 0x14200 zerothread 77087 96467 0 0 3 0x14200 aiodoned aiodoned 1259 478237 0 0 3 0x14200 syncer update 43841 88778 0 0 3 0x14200 cleaner cleaner 31974 205359 0 0 3 0x14200 reaper reaper 61510 435723 0 0 3 0x14200 pgdaemon pagedaemon 97381 81593 0 0 3 0x14200 bored crynlk 99680 306457 0 0 3 0x14200 bored crypto 4143 474025 0 0 3 0x40014200 acpi0 acpi0 24283 412531 0 0 3 0x40014200 idle1 94823 172799 0 0 3 0x14200 bored softnet 76390 444320 0 0 3 0x14200 bored systqmp 33091 326805 0 0 3 0x14200 bored systq 94330 4079 0 0 3 0x40014200 bored softclock 70144 523773 0 0 3 0x40014200 idle0 1 371811 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 41138 (syz-executor.1) thread 0xffff8000226e33d8 (432386) shared rwlock vmmaplk r = 0 (0xfffffd807effe8b8) #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 9462 6330K 6330K 78643K 10554 0 pcb 13 8K 8K 78643K 13 0 rtable 107 3K 3K 78643K 191 0 ifaddr 39 10K 10K 78643K 39 0 counters 43 33K 33K 78643K 43 0 ioctlops 0 0K 2K 78643K 133 0 iov 0 0K 12K 78643K 130 0 mount 1 1K 1K 78643K 1 0 vnodes 1216 76K 76K 78643K 1222 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 5K 78643K 150 0 VM map 2 1K 1K 78643K 2 0 sem 11 1K 1K 78643K 17 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1824 197K 290K 78643K 13058 0 file desc 7 21K 33K 78643K 74201 0 sigio 0 0K 0K 78643K 31 0 proc 48 50K 83K 78643K 393 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 4 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 31 148K 148K 78643K 31 0 exec 0 0K 2K 78643K 326 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 372 59K 61K 78643K 162887 0 UVM aobj 67 3K 3K 78643K 69 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 6 0 NDP 5 0K 0K 78643K 9 0 temp 102 3965K 4029K 78643K 151739 0 kqueue 3 4K 9K 78643K 805 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 33 0 31 1 0 1 1 0 8 0 rtentry 112 46 0 1 2 0 2 2 0 8 0 unpcb 120 86137 0 86129 1 0 1 1 0 8 0 syncache 272 6 0 6 2 2 0 1 0 8 0 tcpqe 32 837 0 837 2 2 0 1 0 8 0 tcpcb 592 47 0 43 1 0 1 1 0 8 0 inpcb 296 319 0 312 2 1 1 2 0 8 0 nd6 48 7 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 189 0 0 12 0 12 12 0 8 0 art_table 32 190 0 0 2 0 2 2 0 8 0 art_node 16 45 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 66 0 2 3 1 2 2 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 79188 0 77791 88 0 88 88 0 8 0 ffsino 272 79188 0 77791 94 0 94 94 0 8 0 nchpl 144 169996 0 168398 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 369607 0 369607 2 1 1 1 0 8 1 percpumem 16 32 0 0 1 0 1 1 0 8 0 scxspl 192 461735 0 461735 12 11 1 7 0 8 1 plimitpl 152 33 0 24 1 0 1 1 0 8 0 sigapl 424 74388 0 74357 4 0 4 4 0 8 0 futexpl 56 483296 0 483296 1 0 1 1 0 8 1 knotepl 112 734 0 714 1 0 1 1 0 8 0 kqueuepl 152 73323 0 73311 1 0 1 1 0 8 0 pipepl 304 20468 0 20457 24 22 2 2 0 8 1 fdescpl 496 74373 0 74357 3 0 3 3 0 8 1 filepl 152 324737 0 324637 16 12 4 5 0 8 0 lockfpl 104 125 0 121 1 0 1 1 0 8 0 lockfspl 48 49 0 45 1 0 1 1 0 8 0 sessionpl 120 17 0 7 1 0 1 1 0 8 0 pgrppl 48 27 0 17 1 0 1 1 0 8 0 ucredpl 96 5787 0 5778 1 0 1 1 0 8 0 zombiepl 144 74357 0 74357 2 1 1 1 0 8 1 processpl 1008 74388 0 74357 5 1 4 5 0 8 0 procpl 632 153839 0 153800 4 0 4 4 0 8 0 sockpl 400 86662 0 86645 36 33 3 4 0 8 1 mcl64k 65536 25 0 0 3 0 3 3 0 8 0 mcl16k 16384 49 0 0 5 2 3 3 0 8 0 mcl12k 12288 41 0 0 3 0 3 3 0 8 0 mcl9k 9216 57 0 0 2 0 2 2 0 8 0 mcl8k 8192 17 0 0 3 0 3 3 0 8 0 mcl4k 4096 33 0 0 4 1 3 3 0 8 0 mcl2k2 2112 18 0 0 2 0 2 2 0 8 0 mcl2k 2048 752 0 0 83 52 31 83 0 8 2 mtagpl 96 1 0 0 1 0 1 1 0 8 0 mbufpl 256 1142 0 0 44 8 36 44 0 8 0 bufpl 280 77739 0 71491 447 0 447 447 0 8 0 anonpl 16 4462840 0 4411690 252 16 236 250 0 124 0 amapchunkpl 152 236922 0 234871 95 13 82 90 0 158 0 amappl16 192 129551 0 128020 90 12 78 88 0 8 1 amappl15 184 74170 0 74166 2 1 1 1 0 8 0 amappl14 176 24 0 19 1 0 1 1 0 8 0 amappl13 168 41 0 39 1 0 1 1 0 8 0 amappl12 160 17 0 13 3 2 1 1 0 8 0 amappl11 152 51 0 42 1 0 1 1 0 8 0 amappl10 144 15 0 11 1 0 1 1 0 8 0 amappl9 136 359 0 359 1 1 0 1 0 8 0 amappl8 128 186 0 121 3 0 3 3 0 8 0 amappl7 120 222 0 212 1 0 1 1 0 8 0 amappl6 112 62 0 49 1 0 1 1 0 8 0 amappl5 104 75763 0 75745 1 0 1 1 0 8 0 amappl4 96 845 0 820 1 0 1 1 0 8 0 amappl3 88 5603 0 5595 1 0 1 1 0 8 0 amappl2 80 517956 0 517892 2 0 2 2 0 8 0 amappl1 72 2347706 0 2347222 29 19 10 18 0 8 0 amappl 80 154315 0 154022 8 1 7 7 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 68 0 2 2 0 2 2 0 8 0 uaddrrnd 24 74373 0 74357 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 74373 0 74357 1 0 1 1 0 8 0 vmmpekpl 168 427888 0 427849 2 0 2 2 0 8 0 vmmpepl 168 9662228 0 9659106 243 104 139 187 0 357 0 vmsppl 368 74372 0 74357 2 0 2 2 0 8 0 pdppl 4096 148753 0 148714 6 1 5 6 0 8 0 pvpl 32 16274476 0 16220118 532 35 497 532 0 265 0 pmappl 232 74372 0 74357 2 1 1 2 0 8 0 extentpl 40 53 0 36 1 0 1 1 0 8 0 phpool 112 390 0 102 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(fffffd805e042808,9,0) at witness_checkorder+0xf5a witness_debugger sys/kern/subr_witness.c:2490 [inline] witness_checkorder(fffffd805e042808,9,0) at witness_checkorder+0xf5a sys/kern/subr_witness.c:1087 rw_enter(fffffd805e0427f8,81) at rw_enter+0xd4 rrw_enter(fffffd805e0427f8,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:462 VOP_LOCK(fffffd8062e618f8,81) at VOP_LOCK+0x4b sys/kern/vfs_vops.c:614 vn_lock(fffffd8062e618f8,81) at vn_lock+0x6c sys/kern/vfs_vnops.c:575 uvn_io(fffffd8062f51648,ffff800025705bf8,1,2,0) at uvn_io+0x2b5 sys/uvm/uvm_vnode.c:1196 uvn_get(fffffd8062f51648,0,ffff800025705e50,ffff800025705dec,0,4) at uvn_get+0x226 sys/uvm/uvm_vnode.c:1056 uvm_fault(fffffd807effe8a0,20ffb000,2,4) at uvm_fault+0x1197 sys/uvm/uvm_fault.c:1016 uvm_fault_wire(fffffd807effe8a0,20ffb000,20ffd000,4) at uvm_fault_wire+0x63 sys/uvm/uvm_fault.c:1285 uvm_map_pageable_wire(fffffd807effe8a0,fffffd80619c7c48,fffffd80619c7468,11c,0,0) at uvm_map_pageable_wire+0x30d sys/uvm/uvm_map.c:2367 sys_mlock(ffff8000226e33d8,ffff800025706038,ffff800025706080) at sys_mlock+0x180 sys/uvm/uvm_mmap.c:772 syscall(ffff800025706100) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff800025706100) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:589 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x8d2c4de24e0, 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 end of kernel end trace frame: 0xc00670a608, count: -3