witness: lock order reversal: 1st 0xfffffd807efff2f8 vmmaplk (&map->lock) 2nd 0xfffffd806baca0a8 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{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(fffffd806baca0a8,9,0) at witness_checkorder+0xf5a witness_debugger sys/kern/subr_witness.c:2490 [inline] witness_checkorder(fffffd806baca0a8,9,0) at witness_checkorder+0xf5a sys/kern/subr_witness.c:1087 rw_enter(fffffd806baca098,81) at rw_enter+0xd4 rrw_enter(fffffd806baca098,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:462 VOP_LOCK(fffffd806ba320f0,81) at VOP_LOCK+0x4b sys/kern/vfs_vops.c:603 vn_lock(fffffd806ba320f0,81) at vn_lock+0x6c sys/kern/vfs_vnops.c:575 uvn_io(fffffd807ca07830,ffff800025710098,1,2,0) at uvn_io+0x2b5 sys/uvm/uvm_vnode.c:1196 uvn_get(fffffd807ca07830,12000,ffff8000257102f0,ffff80002571028c,0,3) at uvn_get+0x226 sys/uvm/uvm_vnode.c:1056 uvm_fault(fffffd807efff2e0,1b32a32000,2,3) at uvm_fault+0x1197 sys/uvm/uvm_fault.c:1016 uvm_fault_wire(fffffd807efff2e0,1b32a20000,1b33a20000,3) at uvm_fault_wire+0x63 sys/uvm/uvm_fault.c:1285 uvm_map_pageable_wire(fffffd807efff2e0,fffffd806912e6c8,0,3aa,ffffffff81071de0,0) at uvm_map_pageable_wire+0x30d sys/uvm/uvm_map.c:2367 sys_mlockall(ffff800021ee5b40,ffff8000257104c8,ffff800025710510) at sys_mlockall+0x6a sys/uvm/uvm_mmap.c:828 syscall(ffff800025710590) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff800025710590) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:567 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xcd438cc88f0, count: -14 ddb{0}> show registers rdi 0x3 rsi 0x40000 acpi_pdirpa+0x2be68 rbp 0xffff80002570fcf0 rbx 0x3 rdx 0xffff800000b07840 rcx 0x3 rax 0x3ffff acpi_pdirpa+0x2be67 r8 0xffffffff817c2c03 witness_checkorder+0xf33 r9 0x5 r10 0xd2498a3cb08ef7ca r11 0x2eeebc2637134a42 r12 0xffffffff82869fa0 w_lodata+0x54590 r13 0 r14 0xffffffff82854cb0 w_lodata+0x3f2a0 r15 0xfffffd8002c8a480 rip 0xffffffff81878348 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff80002570fce0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.1) pid=376883 stat=onproc flags process=10 proc=4000000 pri=32, usrpri=78, nice=20 forw=0xffffffffffffffff, list=0xffff800021ee4c70,0xffffffff82888be0 process=0xffff8000220e8008 user=0xffff80002570b000, vmspace=0xfffffd807efff2e0 estcpu=28, cpticks=6, pctcpu=0.0 user=0, sys=6, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 74113 377999 78925 32767 2 0x10 syz-executor.1 *74113 376883 78925 32767 7 0x4000010 syz-executor.1 32864 240710 77285 32767 2 0x10 syz-executor.0 78925 75301 80878 32767 2 0x10 syz-executor.1 80878 40329 33706 0 3 0x82 wait syz-executor.1 12256 293528 0 0 3 0x14200 bored sosplice 77285 101186 1148 32767 2 0x490 syz-executor.0 1148 415409 33706 0 3 0x82 wait syz-executor.0 33706 5765 73571 0 3 0x82 thrsleep syz-fuzzer 33706 118276 73571 0 2 0x4000482 syz-fuzzer 33706 334832 73571 0 3 0x4000082 thrsleep syz-fuzzer 33706 135883 73571 0 2 0x4000482 syz-fuzzer 33706 369824 73571 0 7 0x4000002 syz-fuzzer 33706 386051 73571 0 3 0x4000082 thrsleep syz-fuzzer 33706 249430 73571 0 3 0x4000082 thrsleep syz-fuzzer 33706 301387 73571 0 2 0x4000482 syz-fuzzer 73571 373634 49494 0 3 0x10008a pause ksh 49494 8893 88462 0 3 0x92 select sshd 65017 103106 1 0 3 0x100083 ttyin getty 88462 265 1 0 3 0x80 select sshd 71101 136573 51965 73 3 0x100090 kqread syslogd 51965 307822 1 0 3 0x100082 netio syslogd 16035 438779 1 77 3 0x100090 poll dhclient 27547 432257 1 0 3 0x80 poll dhclient 40815 517611 0 0 3 0x14200 bored smr 4259 56622 0 0 2 0x14200 zerothread 67146 76995 0 0 3 0x14200 aiodoned aiodoned 33861 233009 0 0 3 0x14200 syncer update 6731 53908 0 0 3 0x14200 cleaner cleaner 83031 106043 0 0 3 0x14200 reaper reaper 84887 239954 0 0 3 0x14200 pgdaemon pagedaemon 80074 275530 0 0 3 0x14200 bored crynlk 7586 135443 0 0 3 0x14200 bored crypto 43577 170475 0 0 3 0x40014200 acpi0 acpi0 75348 391779 0 0 3 0x40014200 idle1 88958 280241 0 0 3 0x14200 bored softnet 58869 395001 0 0 2 0x14200 systqmp 70350 52571 0 0 3 0x14200 bored systq 58627 253110 0 0 2 0x40014200 softclock 21591 10096 0 0 3 0x40014200 idle0 1 482175 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 74113 (syz-executor.1) thread 0xffff800021ee5b40 (376883) shared rwlock vmmaplk r = 0 (0xfffffd807efff2f8) #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 (0xffffffff82889918) #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 Process 33706 (syz-fuzzer) thread 0xffff8000fffff648 (369824) exclusive rwlock pslock r = 0 (0xffff8000ffffd880) #0 witness_lock+0x4b0 stacktrace_save sys/sys/stacktrace.h:36 [inline] #0 witness_lock+0x4b0 sys/kern/subr_witness.c:1164 #1 thrsleep+0x36b sys/kern/kern_synch.c:729 #2 sys___thrsleep+0xb5 sys/kern/kern_synch.c:777 #3 syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] #3 syscall+0x4a1 sys/arch/amd64/amd64/trap.c:567 #4 Xsyscall+0x128 ddb{0}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 9467 6331K 6331K 78643K 10565 0 pcb 13 8K 8K 78643K 13 0 rtable 107 3K 3K 78643K 491 0 ifaddr 39 10K 10K 78643K 53 0 sysctl 0 0K 0K 78643K 4 0 counters 43 33K 33K 78643K 47 0 ioctlops 0 0K 2K 78643K 558 0 iov 0 0K 24K 78643K 342 0 mount 1 1K 1K 78643K 1 0 vnodes 1217 77K 77K 78643K 1509 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 9K 78643K 363 0 VM map 2 1K 1K 78643K 2 0 sem 12 1K 1K 78643K 372 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1824 197K 290K 78643K 13058 0 file desc 8 25K 33K 78643K 26500 0 sigio 0 0K 0K 78643K 91 0 proc 48 50K 83K 78643K 1021 0 subproc 34 2K 2K 78643K 68 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 0K 78643K 950 0 in_multi 33 2K 2K 78643K 322 0 ether_multi 1 0K 0K 78643K 46 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 625 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 279 47K 61K 78643K 57318 0 UVM aobj 131 4K 4K 78643K 147 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 366 0 NDP 5 0K 0K 78643K 15 0 temp 102 3965K 4030K 78643K 55571 0 kqueue 3 4K 16K 78643K 2776 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 10 0 4 1 0 1 1 0 8 0 plcache 128 20 0 0 1 0 1 1 0 8 0 rtpcb 96 322 0 320 1 0 1 1 0 8 0 rtentry 112 69 0 24 2 0 2 2 0 8 0 unpcb 120 4942 0 4928 1 0 1 1 0 8 0 syncache 272 137 0 137 15 15 0 1 0 8 0 tcpqe 32 238 0 238 13 13 0 1 0 8 0 tcpcb 592 3270 0 3266 30 27 3 6 0 8 2 ipq 40 20 0 20 3 3 0 1 0 8 0 ipqe 40 530 0 530 3 3 0 1 0 8 0 inpcb 296 5454 0 5447 13 12 1 3 0 8 0 nd6 48 14 0 7 1 0 1 1 0 8 0 kcovpl 48 4 0 2 1 0 1 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 283 0 93 13 1 12 13 0 8 0 art_table 32 284 0 93 2 0 2 2 0 8 0 art_node 16 68 0 27 1 0 1 1 0 8 0 sysvmsgpl 40 37 0 1 1 0 1 1 0 8 0 semapl 112 363 0 353 1 0 1 1 0 8 0 shmpl 112 144 0 16 4 0 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 29595 0 28196 89 0 89 89 0 8 0 ffsino 272 29595 0 28196 94 0 94 94 0 8 0 nchpl 144 59231 0 57645 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 141895 0 141895 4 3 1 1 0 8 1 percpumem 16 34 0 2 1 0 1 1 0 8 0 scxspl 192 175306 0 175306 17 16 1 7 0 8 1 plimitpl 152 488 0 478 1 0 1 1 0 8 0 sigapl 424 26682 0 26649 4 0 4 4 0 8 0 futexpl 56 168964 0 168964 4 3 1 1 0 8 1 knotepl 112 2739 0 2719 1 0 1 1 0 8 0 kqueuepl 152 28675 0 28665 1 0 1 1 0 8 0 pipepl 304 911 0 900 21 20 1 2 0 8 0 fdescpl 496 26666 0 26649 4 1 3 3 0 8 0 filepl 152 91081 0 90982 10 5 5 6 0 8 1 lockfpl 104 1316 0 1315 1 0 1 1 0 8 0 lockfspl 48 570 0 569 1 0 1 1 0 8 0 sessionpl 120 19 0 9 1 0 1 1 0 8 0 pgrppl 48 156 0 146 1 0 1 1 0 8 0 ucredpl 96 5346 0 5337 1 0 1 1 0 8 0 zombiepl 144 26649 0 26649 1 0 1 1 0 8 1 processpl 1008 26682 0 26649 5 0 5 5 0 8 0 procpl 632 54580 0 54539 4 0 4 4 0 8 0 sosppl 144 145 0 145 11 11 0 1 0 8 0 sockpl 400 10941 0 10918 15 11 4 5 0 8 0 mcl64k 65536 20 0 0 3 1 2 3 0 8 0 mcl16k 16384 17 0 0 3 0 3 3 0 8 0 mcl12k 12288 25 0 0 2 0 2 2 0 8 0 mcl9k 9216 33 0 0 3 1 2 2 0 8 0 mcl8k 8192 14 0 0 2 0 2 2 0 8 0 mcl4k 4096 34 0 0 5 2 3 3 0 8 0 mcl2k2 2112 25 0 0 2 0 2 2 0 8 0 mcl2k 2048 668 0 0 27 0 27 27 0 8 0 mtagpl 96 1 0 0 1 0 1 1 0 8 0 mbufpl 256 1122 0 0 37 0 37 37 0 8 0 bufpl 280 35071 0 28823 447 0 447 447 0 8 0 anonpl 16 1744191 0 1720111 218 121 97 97 0 124 0 amapchunkpl 152 90566 0 89921 63 35 28 29 0 158 3 amappl16 192 52428 0 51579 133 90 43 48 0 8 0 amappl15 184 1 0 0 1 0 1 1 0 8 0 amappl14 176 13211 0 13203 1 0 1 1 0 8 0 amappl13 168 1050 0 1048 1 0 1 1 0 8 0 amappl12 160 23 0 18 2 1 1 1 0 8 0 amappl11 152 2278 0 2268 1 0 1 1 0 8 0 amappl10 144 8 0 5 1 0 1 1 0 8 0 amappl9 136 11112 0 11108 1 0 1 1 0 8 0 amappl8 128 518 0 341 6 0 6 6 0 8 0 amappl7 120 10201 0 10189 1 0 1 1 0 8 0 amappl6 112 81 0 60 1 0 1 1 0 8 0 amappl5 104 14238 0 14221 1 0 1 1 0 8 0 amappl4 96 15777 0 15744 1 0 1 1 0 8 0 amappl3 88 562 0 553 1 0 1 1 0 8 0 amappl2 80 184126 0 184058 2 0 2 2 0 8 0 amappl1 72 774051 0 773557 27 17 10 18 0 8 0 amappl 80 55048 0 54942 3 0 3 3 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 146 0 16 4 1 3 3 0 8 0 uaddrrnd 24 26666 0 26649 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 26666 0 26649 1 0 1 1 0 8 0 vmmpekpl 168 101298 0 101258 6 3 3 3 0 8 0 vmmpepl 168 3440410 0 3437939 204 93 111 114 0 357 3 vmsppl 368 26665 0 26649 2 0 2 2 0 8 0 pdppl 4096 53339 0 53298 8 2 6 6 0 8 0 pvpl 32 6959586 0 6932258 464 243 221 221 0 265 0 pmappl 232 26665 0 26649 2 1 1 2 0 8 0 extentpl 40 53 0 36 1 0 1 1 0 8 0 phpool 112 323 0 37 9 0 9 9 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(fffffd806baca0a8,9,0) at witness_checkorder+0xf5a witness_debugger sys/kern/subr_witness.c:2490 [inline] witness_checkorder(fffffd806baca0a8,9,0) at witness_checkorder+0xf5a sys/kern/subr_witness.c:1087 rw_enter(fffffd806baca098,81) at rw_enter+0xd4 rrw_enter(fffffd806baca098,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:462 VOP_LOCK(fffffd806ba320f0,81) at VOP_LOCK+0x4b sys/kern/vfs_vops.c:603 vn_lock(fffffd806ba320f0,81) at vn_lock+0x6c sys/kern/vfs_vnops.c:575 uvn_io(fffffd807ca07830,ffff800025710098,1,2,0) at uvn_io+0x2b5 sys/uvm/uvm_vnode.c:1196 uvn_get(fffffd807ca07830,12000,ffff8000257102f0,ffff80002571028c,0,3) at uvn_get+0x226 sys/uvm/uvm_vnode.c:1056 uvm_fault(fffffd807efff2e0,1b32a32000,2,3) at uvm_fault+0x1197 sys/uvm/uvm_fault.c:1016 uvm_fault_wire(fffffd807efff2e0,1b32a20000,1b33a20000,3) at uvm_fault_wire+0x63 sys/uvm/uvm_fault.c:1285 uvm_map_pageable_wire(fffffd807efff2e0,fffffd806912e6c8,0,3aa,ffffffff81071de0,0) at uvm_map_pageable_wire+0x30d sys/uvm/uvm_map.c:2367 sys_mlockall(ffff800021ee5b40,ffff8000257104c8,ffff800025710510) at sys_mlockall+0x6a sys/uvm/uvm_mmap.c:828 syscall(ffff800025710590) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff800025710590) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:567 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xcd438cc88f0, 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 __sanitizer_cov_trace_pc() at __sanitizer_cov_trace_pc+0x37 kd_curproc sys/dev/kcov.c:569 [inline] __sanitizer_cov_trace_pc() at __sanitizer_cov_trace_pc+0x37 sys/dev/kcov.c:143 __mp_lock(ffffffff82889710) at __mp_lock+0x133 __mp_lock_spin sys/kern/kern_lock.c:116 [inline] __mp_lock(ffffffff82889710) at __mp_lock+0x133 sys/kern/kern_lock.c:147 sleep_setup(ffff800021297d40,ffff800021297df8,120,ffffffff8242ce56) at sleep_setup+0xcf sys/kern/kern_synch.c:373 rwsleep(ffff800021297df8,ffff8000ffffd870,120,ffffffff8242ce56,0) at rwsleep+0x81 sleep_setup_timeout sys/kern/kern_synch.c:435 [inline] rwsleep(ffff800021297df8,ffff8000ffffd870,120,ffffffff8242ce56,0) at rwsleep+0x81 sys/kern/kern_synch.c:307 thrsleep(ffff8000fffff648,ffff800021297ee0) at thrsleep+0x3f2 sys/kern/kern_synch.c:736 sys___thrsleep(ffff8000fffff648,ffff800021297ee0,ffff800021297f30) at sys___thrsleep+0xb5 sys/kern/kern_synch.c:777 syscall(ffff800021297fb0) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff800021297fb0) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:567 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xc00004bdd8, count: -11