witness: lock order reversal: 1st 0xfffffd807effeb98 vmmaplk (&map->lock) 2nd 0xfffffd8065578e70 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 pageflttrap+0x254 sys/arch/amd64/amd64/trap.c:219 #5 kerntrap+0xf1 sys/arch/amd64/amd64/trap.c:301 #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:247 #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:567 #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:603 #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_mlockall+0x6a sys/uvm/uvm_mmap.c:828 #11 syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] #11 syscall+0x4a1 sys/arch/amd64/amd64/trap.c:567 #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(fffffd8065578e70,9,0) at witness_checkorder+0xf5a witness_debugger sys/kern/subr_witness.c:2490 [inline] witness_checkorder(fffffd8065578e70,9,0) at witness_checkorder+0xf5a sys/kern/subr_witness.c:1087 rw_enter(fffffd8065578e60,81) at rw_enter+0xd4 rrw_enter(fffffd8065578e60,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:462 VOP_LOCK(fffffd80655d0c30,81) at VOP_LOCK+0x4b sys/kern/vfs_vops.c:603 vn_lock(fffffd80655d0c30,81) at vn_lock+0x6c sys/kern/vfs_vnops.c:575 uvn_io(fffffd806dd2ce60,ffff800022323258,1,2,0) at uvn_io+0x2b5 sys/uvm/uvm_vnode.c:1196 uvn_get(fffffd806dd2ce60,a000,ffff8000223234b0,ffff80002232344c,0,3) at uvn_get+0x226 sys/uvm/uvm_vnode.c:1056 uvm_fault(fffffd807effeb80,1b30f2a000,2,3) at uvm_fault+0x1197 sys/uvm/uvm_fault.c:1016 uvm_fault_wire(fffffd807effeb80,1b30f20000,1b31f20000,3) at uvm_fault_wire+0x63 sys/uvm/uvm_fault.c:1285 uvm_map_pageable_wire(fffffd807effeb80,fffffd805f1206a8,0,396,ffffffff8228a410,0) at uvm_map_pageable_wire+0x30d sys/uvm/uvm_map.c:2367 sys_mlockall(ffff800022f0a510,ffff800022323688,ffff8000223236d0) at sys_mlockall+0x6a sys/uvm/uvm_mmap.c:828 syscall(ffff800022323750) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff800022323750) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:567 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xd42293b31c0, count: -14 ddb{1}> show registers rdi 0x3 rsi 0x40000 acpi_pdirpa+0x2be68 rbp 0xffff800022322eb0 rbx 0x3 rdx 0xffff800000b06880 rcx 0x3 rax 0x3ffff acpi_pdirpa+0x2be67 r8 0xffffffff8129a523 witness_checkorder+0xf33 r9 0x5 r10 0x52ca5e177c9bc409 r11 0x825f9bbc37b89b59 r12 0xffffffff8281d880 w_lodata+0x54380 r13 0 r14 0xffffffff82809a30 w_lodata+0x40530 r15 0xfffffd8002c8f480 rip 0xffffffff819aafe8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff800022322ea0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{1}> show proc PROC (syz-executor.1) pid=380930 stat=onproc flags process=0 proc=4000000 pri=32, usrpri=86, nice=20 forw=0xffffffffffffffff, list=0xffff800022f0aa00,0xffffffff8287f558 process=0xffff800022efdba0 user=0xffff80002231e000, vmspace=0xfffffd807effeb80 estcpu=36, cpticks=7, pctcpu=0.0 user=0, sys=7, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND 15416 42621 69971 0 7 0 syz-executor.1 *15416 380930 69971 0 7 0x4000000 syz-executor.1 64952 50945 2914 0 3 0x80 nanosleep syz-executor.0 64952 106342 2914 0 3 0x4000080 netcon syz-executor.0 64952 351304 2914 0 3 0x4000080 fsleep syz-executor.0 87596 73486 0 0 3 0x14200 acct acct 69971 185413 32477 0 3 0x82 nanosleep syz-executor.1 2914 167348 32477 0 3 0x82 nanosleep syz-executor.0 32477 203736 55150 0 3 0x82 thrsleep syz-fuzzer 32477 305545 55150 0 3 0x4000082 nanosleep syz-fuzzer 32477 203714 55150 0 3 0x4000082 thrsleep syz-fuzzer 32477 406022 55150 0 3 0x4000082 thrsleep syz-fuzzer 32477 4518 55150 0 3 0x4000082 thrsleep syz-fuzzer 32477 52229 55150 0 3 0x4000082 thrsleep syz-fuzzer 32477 430051 55150 0 3 0x4000082 thrsleep syz-fuzzer 32477 461181 55150 0 3 0x4000082 kqread syz-fuzzer 55150 142323 93941 0 3 0x10008a pause ksh 93941 483770 69992 0 3 0x92 select sshd 99328 76880 1 0 3 0x100083 ttyin getty 69992 455994 1 0 3 0x80 select sshd 89215 217262 23408 74 3 0x100092 bpf pflogd 23408 88890 1 0 3 0x80 netio pflogd 21604 436843 31372 73 3 0x100090 kqread syslogd 31372 156257 1 0 3 0x100082 netio syslogd 1232 291783 1 77 3 0x100090 poll dhclient 33440 496493 1 0 3 0x80 poll dhclient 47600 323268 0 0 3 0x14200 bored smr 76233 235188 0 0 2 0x14200 zerothread 9797 510384 0 0 3 0x14200 aiodoned aiodoned 15970 255659 0 0 3 0x14200 syncer update 82101 389861 0 0 3 0x14200 cleaner cleaner 86111 299600 0 0 3 0x14200 reaper reaper 25035 193236 0 0 3 0x14200 pgdaemon pagedaemon 65718 190100 0 0 3 0x14200 bored crynlk 99620 173220 0 0 3 0x14200 bored crypto 91215 322744 0 0 3 0x40014200 acpi0 acpi0 24143 77239 0 0 3 0x40014200 idle1 17369 188028 0 0 3 0x14200 bored softnet 79856 455534 0 0 3 0x14200 bored systqmp 74363 394018 0 0 3 0x14200 bored systq 56500 435542 0 0 3 0x40014200 bored softclock 4160 443860 0 0 3 0x40014200 idle0 1 261054 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{1}> show all locks Process 15416 (syz-executor.1) thread 0xffff800022f0a510 (380930) 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_all+0x56 sys/uvm/uvm_map.c:2576 #4 sys_mlockall+0x6a sys/uvm/uvm_mmap.c:828 #5 syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] #5 syscall+0x4a1 sys/arch/amd64/amd64/trap.c:567 #6 Xsyscall+0x128 exclusive kernel_lock &kernel_lock r = 0 (0xffffffff8287d770) #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:567 #2 Xsyscall+0x128 ddb{1}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 9480 6402K 7435K 78643K 37971 0 pcb 13 8K 8K 78643K 93 0 rtable 105 3K 3K 78643K 246 0 ifaddr 49 11K 12K 78643K 85 0 counters 43 33K 34K 78643K 57 0 ioctlops 0 0K 4K 78643K 1500 0 iov 0 0K 16K 78643K 55 0 mount 1 1K 1K 78643K 1 0 vnodes 1215 76K 77K 78643K 22488 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 5K 78643K 21 0 VM map 2 1K 1K 78643K 2 0 sem 12 0K 0K 78643K 209 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1824 197K 290K 78643K 13058 0 file desc 6 17K 25K 78643K 201457 0 sigio 0 0K 0K 78643K 25 0 proc 61 63K 95K 78643K 463 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 70 0 in_multi 33 2K 2K 78643K 51 0 ether_multi 1 0K 0K 78643K 3 0 mrt 0 0K 0K 78643K 1 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 55 254K 254K 78643K 55 0 exec 0 0K 2K 78643K 637 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 229 37K 39K 78643K 408224 0 UVM aobj 49 7K 7K 78643K 64 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 26 0 NDP 7 0K 0K 78643K 18 0 temp 111 3962K 4026K 78643K 426547 0 kqueue 3 4K 8K 78643K 11 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 96 55 0 53 1 0 1 1 0 8 0 rtentry 112 45 0 1 2 0 2 2 0 8 0 unpcb 120 12727 0 12717 1 0 1 1 0 8 0 syncache 272 5 0 5 2 2 0 1 0 8 0 tcpqe 32 1263 0 1263 4 4 0 3 0 8 0 tcpcb 592 207 0 199 2 0 2 2 0 8 1 inpcb 296 570 0 561 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 pffrag 232 1 0 1 1 1 0 1 0 482 0 pffrnode 88 1 0 1 1 1 0 1 0 8 0 pffrent 40 2 0 2 1 1 0 1 0 8 0 pfosfp 40 846 0 423 5 0 5 5 0 8 0 pfosfpen 112 1428 0 714 21 0 21 21 0 8 0 pfstitem 24 19 0 14 1 0 1 1 0 8 0 pfstkey 112 19 0 14 1 0 1 1 0 8 0 pfstate 328 19 0 14 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 4 0 4 2 2 0 1 0 8 0 semapl 112 207 0 197 1 0 1 1 0 8 0 shmpl 112 61 0 15 2 0 2 2 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 203309 0 201916 89 1 88 89 0 8 0 ffsino 272 203309 0 201916 95 1 94 94 0 8 0 nchpl 144 405799 0 404208 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 838213 0 838213 2 1 1 1 0 8 1 percpumem 16 39 0 7 1 0 1 1 0 8 0 scxspl 192 1216639 0 1216639 9 8 1 7 0 8 1 plimitpl 152 44 0 35 1 0 1 1 0 8 0 sigapl 424 201673 0 201640 4 0 4 4 0 8 0 futexpl 56 793190 0 793189 1 0 1 1 0 8 0 knotepl 112 68 0 48 1 0 1 1 0 8 0 kqueuepl 152 196838 0 196836 1 0 1 1 0 8 0 pipepl 304 278 0 267 12 10 2 2 0 8 1 fdescpl 496 201657 0 201640 3 0 3 3 0 8 0 filepl 152 439182 0 439077 6 1 5 5 0 8 0 lockfpl 104 384 0 383 1 0 1 1 0 8 0 lockfspl 48 133 0 132 1 0 1 1 0 8 0 sessionpl 120 18 0 7 1 0 1 1 0 8 0 pgrppl 48 126 0 115 1 0 1 1 0 8 0 ucredpl 96 357 0 348 1 0 1 1 0 8 0 zombiepl 144 201640 0 201640 2 1 1 1 0 8 1 processpl 1008 201673 0 201640 6 1 5 5 0 8 0 procpl 632 407222 0 407179 5 1 4 4 0 8 0 sockpl 400 13352 0 13331 31 28 3 4 0 8 0 mcl64k 65536 6 0 0 1 0 1 1 0 8 0 mcl16k 16384 1 0 0 1 0 1 1 0 8 0 mcl12k 12288 19 0 0 2 0 2 2 0 8 0 mcl9k 9216 18 0 0 2 0 2 2 0 8 0 mcl8k 8192 4 0 0 1 0 1 1 0 8 0 mcl4k 4096 15 0 0 2 0 2 2 0 8 0 mcl2k2 2112 6 0 0 1 0 1 1 0 8 0 mcl2k 2048 481 0 0 52 19 33 52 0 8 0 mtagpl 96 4 0 0 1 0 1 1 0 8 0 mbufpl 256 884 0 0 28 12 16 28 0 8 0 bufpl 280 206381 0 200131 447 0 447 447 0 8 0 anonpl 16 11580004 0 11532252 205 13 192 192 0 124 0 amapchunkpl 152 615529 0 614377 53 4 49 49 0 158 4 amappl16 192 484840 0 483006 116 24 92 95 0 8 0 amappl15 184 3 0 0 1 0 1 1 0 8 0 amappl14 176 26 0 20 1 0 1 1 0 8 0 amappl13 168 2358 0 2356 1 0 1 1 0 8 0 amappl12 160 10 0 7 1 0 1 1 0 8 0 amappl11 152 100679 0 100660 1 0 1 1 0 8 0 amappl10 144 9 0 5 1 0 1 1 0 8 0 amappl9 136 101168 0 101165 1 0 1 1 0 8 0 amappl8 128 161 0 115 2 0 2 2 0 8 0 amappl7 120 101043 0 101033 1 0 1 1 0 8 0 amappl6 112 64 0 53 1 0 1 1 0 8 0 amappl5 104 301829 0 301807 1 0 1 1 0 8 0 amappl4 96 288 0 259 1 0 1 1 0 8 0 amappl3 88 243 0 233 1 0 1 1 0 8 0 amappl2 80 1402265 0 1402193 2 0 2 2 0 8 0 amappl1 72 5589186 0 5588656 26 16 10 19 0 8 0 amappl 80 407596 0 407432 4 0 4 4 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 63 0 15 1 0 1 1 0 8 0 uaddrrnd 24 201657 0 201640 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 201657 0 201640 1 0 1 1 0 8 0 vmmpekpl 168 623782 0 623746 2 0 2 2 0 8 0 vmmpepl 168 24787172 0 24783881 259 114 145 146 0 357 1 vmsppl 368 201656 0 201640 2 0 2 2 0 8 0 pdppl 4096 403321 0 403280 7 1 6 6 0 8 0 pvpl 32 36985234 0 36934193 480 68 412 412 0 265 0 pmappl 232 201656 0 201640 2 1 1 2 0 8 0 extentpl 40 53 0 36 1 0 1 1 0 8 0 phpool 112 333 0 68 9 0 9 9 0 8 0 ddb{1}> machine ddbcpu 0 Stopped at x86_ipi_db+0x1a: addq $0x8,%rsp ddb{0}> trace x86_ipi_db(ffffffff8271aff0) 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 intr_handler(ffff80002231dd50,ffff80000065bd80) 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+0x3e kd_curproc sys/dev/kcov.c:570 [inline] __sanitizer_cov_trace_pc() at __sanitizer_cov_trace_pc+0x3e sys/dev/kcov.c:143 __mp_lock(ffffffff8287d568) at __mp_lock+0x133 __mp_lock_spin sys/kern/kern_lock.c:116 [inline] __mp_lock(ffffffff8287d568) 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 end of kernel end trace frame: 0x7f7ffffc1710, 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(fffffd8065578e70,9,0) at witness_checkorder+0xf5a witness_debugger sys/kern/subr_witness.c:2490 [inline] witness_checkorder(fffffd8065578e70,9,0) at witness_checkorder+0xf5a sys/kern/subr_witness.c:1087 rw_enter(fffffd8065578e60,81) at rw_enter+0xd4 rrw_enter(fffffd8065578e60,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:462 VOP_LOCK(fffffd80655d0c30,81) at VOP_LOCK+0x4b sys/kern/vfs_vops.c:603 vn_lock(fffffd80655d0c30,81) at vn_lock+0x6c sys/kern/vfs_vnops.c:575 uvn_io(fffffd806dd2ce60,ffff800022323258,1,2,0) at uvn_io+0x2b5 sys/uvm/uvm_vnode.c:1196 uvn_get(fffffd806dd2ce60,a000,ffff8000223234b0,ffff80002232344c,0,3) at uvn_get+0x226 sys/uvm/uvm_vnode.c:1056 uvm_fault(fffffd807effeb80,1b30f2a000,2,3) at uvm_fault+0x1197 sys/uvm/uvm_fault.c:1016 uvm_fault_wire(fffffd807effeb80,1b30f20000,1b31f20000,3) at uvm_fault_wire+0x63 sys/uvm/uvm_fault.c:1285 uvm_map_pageable_wire(fffffd807effeb80,fffffd805f1206a8,0,396,ffffffff8228a410,0) at uvm_map_pageable_wire+0x30d sys/uvm/uvm_map.c:2367 sys_mlockall(ffff800022f0a510,ffff800022323688,ffff8000223236d0) at sys_mlockall+0x6a sys/uvm/uvm_mmap.c:828 syscall(ffff800022323750) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff800022323750) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:567 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xd42293b31c0, count: -14