witness: lock order reversal: 1st 0xfffffd807effea28 vmmaplk (&map->lock) 2nd 0xfffffd8055978098 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: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: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: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: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(fffffd8055978098,9,0) at witness_checkorder+0xf5a witness_debugger sys/kern/subr_witness.c:2490 [inline] witness_checkorder(fffffd8055978098,9,0) at witness_checkorder+0xf5a sys/kern/subr_witness.c:1087 rw_enter(fffffd8055978088,81) at rw_enter+0xd4 rrw_enter(fffffd8055978088,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:462 VOP_LOCK(fffffd80532ddb68,81) at VOP_LOCK+0x4b sys/kern/vfs_vops.c:614 vn_lock(fffffd80532ddb68,81) at vn_lock+0x6c sys/kern/vfs_vnops.c:575 uvn_io(fffffd80530e6648,ffff80002571e448,1,2,0) at uvn_io+0x2b5 sys/uvm/uvm_vnode.c:1196 uvn_get(fffffd80530e6648,1000,ffff80002571e6a0,ffff80002571e63c,0,5) at uvn_get+0x226 sys/uvm/uvm_vnode.c:1056 uvm_fault(fffffd807effea10,20001000,2,5) at uvm_fault+0x1197 sys/uvm/uvm_fault.c:1016 uvm_fault_wire(fffffd807effea10,20001000,20005000,5) at uvm_fault_wire+0x63 sys/uvm/uvm_fault.c:1285 uvm_map_pageable_wire(fffffd807effea10,fffffd8067ab29e8,fffffd8067ab22b0,39c,ffffffff82331ade,0) at uvm_map_pageable_wire+0x30d sys/uvm/uvm_map.c:2367 sys_mlock(ffff8000ffffa9f8,ffff80002571e888,ffff80002571e8d0) at sys_mlock+0x180 sys/uvm/uvm_mmap.c:772 syscall(ffff80002571e950) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff80002571e950) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:567 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x8b28797d50, count: -14 ddb{0}> show registers rdi 0x3 rsi 0x40000 acpi_pdirpa+0x2be68 rbp 0xffff80002571e0a0 rbx 0x3 rdx 0xffff800000af3d40 rcx 0x3 rax 0x3ffff acpi_pdirpa+0x2be67 r8 0xffffffff8232f783 witness_checkorder+0xf33 r9 0x5 r10 0xce1d5c98c21a8974 r11 0xae1021a9aad656ad r12 0xffffffff8287a6d0 w_lodata+0x54590 r13 0 r14 0xffffffff82863bd0 w_lodata+0x3da90 r15 0xfffffd8002c93480 rip 0xffffffff81842498 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff80002571e090 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.1) pid=446541 stat=onproc flags process=10 proc=4000000 pri=32, usrpri=86, nice=20 forw=0xffffffffffffffff, list=0xffff8000ffffa018,0xffffffff828a8b58 process=0xffff8000ffff97a8 user=0xffff800025719000, vmspace=0xfffffd807effea10 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 50893 194684 4117 32767 2 0x10 syz-executor.1 *50893 446541 4117 32767 7 0x4000010 syz-executor.1 69997 189596 0 0 3 0x14200 bored sosplice 4117 145943 91276 32767 3 0x90 nanosleep syz-executor.1 90296 205870 22200 32767 3 0x90 nanosleep syz-executor.0 91276 103118 18172 0 3 0x82 wait syz-executor.1 22200 208425 18172 0 3 0x82 wait syz-executor.0 18172 19611 41787 0 3 0x82 thrsleep syz-fuzzer 18172 355598 41787 0 3 0x4000082 thrsleep syz-fuzzer 18172 440259 41787 0 3 0x4000082 thrsleep syz-fuzzer 18172 351967 41787 0 3 0x4000082 thrsleep syz-fuzzer 18172 182953 41787 0 3 0x4000082 thrsleep syz-fuzzer 18172 120974 41787 0 3 0x4000082 thrsleep syz-fuzzer 18172 153512 41787 0 3 0x4000082 thrsleep syz-fuzzer 18172 261989 41787 0 3 0x4000082 kqread syz-fuzzer 41787 192656 65326 0 3 0x10008a pause ksh 65326 44970 66139 0 3 0x92 select sshd 40847 444620 1 0 3 0x100083 ttyin getty 66139 407857 1 0 3 0x80 select sshd 21586 509790 50547 73 3 0x100090 kqread syslogd 50547 55523 1 0 3 0x100082 netio syslogd 17735 393370 1 77 3 0x100090 poll dhclient 17255 31237 1 0 3 0x80 poll dhclient 32294 34866 0 0 3 0x14200 bored smr 63136 278739 0 0 2 0x14200 zerothread 28890 278652 0 0 3 0x14200 aiodoned aiodoned 95286 153357 0 0 3 0x14200 syncer update 14428 124079 0 0 3 0x14200 cleaner cleaner 32005 428404 0 0 7 0x14200 reaper 64875 423500 0 0 3 0x14200 pgdaemon pagedaemon 82507 55842 0 0 3 0x14200 bored crynlk 36358 286368 0 0 3 0x14200 bored crypto 74350 485748 0 0 3 0x40014200 acpi0 acpi0 41131 205136 0 0 3 0x40014200 idle1 45894 259933 0 0 3 0x14200 bored softnet 45673 379118 0 0 3 0x14200 bored systqmp 24678 202455 0 0 3 0x14200 bored systq 20543 334769 0 0 3 0x40014200 bored softclock 18960 90216 0 0 3 0x40014200 idle0 1 499515 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 50893 (syz-executor.1) thread 0xffff8000ffffa9f8 (446541) shared rwlock vmmaplk r = 0 (0xfffffd807effea28) #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:567 #6 Xsyscall+0x128 exclusive kernel_lock &kernel_lock r = 0 (0xffffffff8289d1b8) #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{0}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 9465 6330K 6330K 78643K 10557 0 pcb 13 8K 8K 78643K 13 0 rtable 105 3K 3K 78643K 191 0 ifaddr 39 10K 10K 78643K 39 0 counters 43 33K 33K 78643K 43 0 ioctlops 0 0K 2K 78643K 172 0 iov 0 0K 8K 78643K 27 0 mount 1 1K 1K 78643K 1 0 vnodes 1217 77K 77K 78643K 1222 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 5K 78643K 33 0 VM map 2 1K 1K 78643K 2 0 sem 12 0K 1K 78643K 6299 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1824 197K 290K 78643K 13058 0 file desc 7 21K 33K 78643K 53871 0 sigio 0 0K 0K 78643K 6 0 proc 48 50K 70K 78643K 370 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 34 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 43 201K 201K 78643K 43 0 exec 0 0K 2K 78643K 317 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 577 69K 74K 78643K 115957 0 UVM aobj 131 4K 4K 78643K 133 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 101 3961K 4025K 78643K 110364 0 kqueue 3 4K 9K 78643K 763 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 23 0 21 1 0 1 1 0 8 0 rtentry 112 45 0 1 2 0 2 2 0 8 0 unpcb 120 31182 0 31174 1 0 1 1 0 8 0 syncache 272 4 0 4 1 1 0 1 0 8 0 tcpqe 32 174 0 174 1 1 0 1 0 8 0 tcpcb 592 20 0 16 1 0 1 1 0 8 0 inpcb 296 74 0 67 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 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 44 0 4 1 0 1 1 0 8 0 sysvmsgpl 40 32 0 0 1 0 1 1 0 8 0 semupl 112 1 0 1 1 1 0 1 0 8 0 semapl 112 6297 0 6287 1 0 1 1 0 8 0 shmpl 112 130 0 2 4 0 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 69041 0 67643 88 0 88 88 0 8 0 ffsino 272 69041 0 67643 94 0 94 94 0 8 0 nchpl 144 142582 0 140983 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 302841 0 302841 2 1 1 1 0 8 1 percpumem 16 32 0 0 1 0 1 1 0 8 0 scxspl 192 382962 0 382962 11 10 1 7 0 8 1 plimitpl 152 22 0 13 1 0 1 1 0 8 0 sigapl 424 54059 0 54027 4 0 4 4 0 8 0 futexpl 56 423119 0 423119 1 0 1 1 0 8 1 knotepl 112 453 0 433 1 0 1 1 0 8 0 kqueuepl 152 68415 0 68410 1 0 1 1 0 8 0 pipepl 304 12025 0 12014 11 9 2 2 0 8 1 fdescpl 496 54043 0 54027 3 0 3 3 0 8 0 filepl 152 234272 0 234171 11 6 5 5 0 8 1 lockfpl 104 27482 0 27480 1 0 1 1 0 8 0 lockfspl 48 13739 0 13737 1 0 1 1 0 8 0 sessionpl 120 17 0 7 1 0 1 1 0 8 0 pgrppl 48 218 0 208 1 0 1 1 0 8 0 ucredpl 96 8721 0 8712 1 0 1 1 0 8 0 zombiepl 144 54027 0 54026 2 1 1 1 0 8 0 processpl 1008 54059 0 54026 5 0 5 5 0 8 0 procpl 632 109371 0 109330 4 0 4 4 0 8 0 sosppl 144 1 0 1 1 0 1 1 0 8 1 sockpl 400 31312 0 31295 14 11 3 4 0 8 1 mcl64k 65536 43 0 0 3 0 3 3 0 8 0 mcl16k 16384 26 0 0 3 0 3 3 0 8 0 mcl12k 12288 50 0 0 3 0 3 3 0 8 0 mcl9k 9216 34 0 0 2 0 2 2 0 8 0 mcl8k 8192 33 0 0 3 0 3 3 0 8 0 mcl4k 4096 25 0 0 3 0 3 3 0 8 0 mcl2k2 2112 17 0 0 2 0 2 2 0 8 0 mcl2k 2048 329 0 0 35 5 30 35 0 8 0 mtagpl 96 1 0 0 1 0 1 1 0 8 0 mbufpl 256 833 0 0 21 0 21 21 0 8 0 bufpl 280 70470 0 64224 447 0 447 447 0 8 0 anonpl 16 3353827 0 3275528 384 2 382 382 0 124 0 amapchunkpl 152 170542 0 167297 149 2 147 149 0 158 0 amappl16 192 80876 0 78755 108 1 107 107 0 8 0 amappl15 184 2 0 1 1 0 1 1 0 8 0 amappl14 176 26 0 19 1 0 1 1 0 8 0 amappl13 168 3969 0 3966 1 0 1 1 0 8 0 amappl12 160 26865 0 26859 1 0 1 1 0 8 0 amappl11 152 51 0 42 1 0 1 1 0 8 0 amappl10 144 27001 0 26994 1 0 1 1 0 8 0 amappl9 136 369 0 369 3 3 0 1 0 8 0 amappl8 128 161 0 110 2 0 2 2 0 8 0 amappl7 120 224 0 213 1 0 1 1 0 8 0 amappl6 112 27041 0 27030 1 0 1 1 0 8 0 amappl5 104 62399 0 62382 1 0 1 1 0 8 0 amappl4 96 31177 0 31151 1 0 1 1 0 8 0 amappl3 88 10803 0 10795 1 0 1 1 0 8 0 amappl2 80 382021 0 381953 2 0 2 2 0 8 0 amappl1 72 1640586 0 1640054 24 13 11 18 0 8 1 amappl 80 110112 0 109599 11 0 11 11 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 132 0 2 3 0 3 3 0 8 0 uaddrrnd 24 54043 0 54027 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 54043 0 54027 1 0 1 1 0 8 0 vmmpekpl 168 210038 0 210009 2 0 2 2 0 8 0 vmmpepl 168 7031075 0 7027065 291 114 177 255 0 357 1 vmsppl 368 54042 0 54026 2 0 2 2 0 8 0 pdppl 4096 108093 0 108052 6 0 6 6 0 8 0 pvpl 32 10558026 0 10476582 794 1 793 794 0 265 0 pmappl 232 54042 0 54026 2 1 1 2 0 8 0 extentpl 40 53 0 36 1 0 1 1 0 8 0 phpool 112 293 0 20 8 0 8 8 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(fffffd8055978098,9,0) at witness_checkorder+0xf5a witness_debugger sys/kern/subr_witness.c:2490 [inline] witness_checkorder(fffffd8055978098,9,0) at witness_checkorder+0xf5a sys/kern/subr_witness.c:1087 rw_enter(fffffd8055978088,81) at rw_enter+0xd4 rrw_enter(fffffd8055978088,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:462 VOP_LOCK(fffffd80532ddb68,81) at VOP_LOCK+0x4b sys/kern/vfs_vops.c:614 vn_lock(fffffd80532ddb68,81) at vn_lock+0x6c sys/kern/vfs_vnops.c:575 uvn_io(fffffd80530e6648,ffff80002571e448,1,2,0) at uvn_io+0x2b5 sys/uvm/uvm_vnode.c:1196 uvn_get(fffffd80530e6648,1000,ffff80002571e6a0,ffff80002571e63c,0,5) at uvn_get+0x226 sys/uvm/uvm_vnode.c:1056 uvm_fault(fffffd807effea10,20001000,2,5) at uvm_fault+0x1197 sys/uvm/uvm_fault.c:1016 uvm_fault_wire(fffffd807effea10,20001000,20005000,5) at uvm_fault_wire+0x63 sys/uvm/uvm_fault.c:1285 uvm_map_pageable_wire(fffffd807effea10,fffffd8067ab29e8,fffffd8067ab22b0,39c,ffffffff82331ade,0) at uvm_map_pageable_wire+0x30d sys/uvm/uvm_map.c:2367 sys_mlock(ffff8000ffffa9f8,ffff80002571e888,ffff80002571e8d0) at sys_mlock+0x180 sys/uvm/uvm_mmap.c:772 syscall(ffff80002571e950) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff80002571e950) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:567 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x8b28797d50, 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(ffffffff8289cfb0) at __mp_lock+0x122 __mp_lock_spin sys/kern/kern_lock.c:116 [inline] __mp_lock(ffffffff8289cfb0) at __mp_lock+0x122 sys/kern/kern_lock.c:147 uvm_unmap_detach(ffff8000211df570,1) at uvm_unmap_detach+0xfc sys/uvm/uvm_map.c:1588 uvm_map_teardown(fffffd807effe730) at uvm_map_teardown+0x262 sys/uvm/uvm_map.c:2764 uvmspace_free(fffffd807effe730) at uvmspace_free+0x86 sys/uvm/uvm_map.c:3653 uvm_exit(ffff8000ffff8bd8) at uvm_exit+0x29 sys/uvm/uvm_glue.c:297 reaper(ffff800021199b28) at reaper+0x189 sys/kern/kern_exit.c:456 end trace frame: 0x0, count: -9