witness: lock order reversal: 1st 0xfffffd807effe748 vmmaplk (&map->lock) 2nd 0xfffffd80311622b8 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(fffffd80311622b8,9,0) at witness_checkorder+0xf5a witness_debugger sys/kern/subr_witness.c:2490 [inline] witness_checkorder(fffffd80311622b8,9,0) at witness_checkorder+0xf5a sys/kern/subr_witness.c:1087 rw_enter(fffffd80311622a8,81) at rw_enter+0xd4 rrw_enter(fffffd80311622a8,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:462 VOP_LOCK(fffffd806eede348,81) at VOP_LOCK+0x4b sys/kern/vfs_vops.c:614 vn_lock(fffffd806eede348,81) at vn_lock+0x6c sys/kern/vfs_vnops.c:575 uvn_io(fffffd806eee40d8,ffff80002571dcd8,1,2,0) at uvn_io+0x2b5 sys/uvm/uvm_vnode.c:1196 uvn_get(fffffd806eee40d8,8000000000001000,ffff80002571df30,ffff80002571decc,0,0) at uvn_get+0x226 sys/uvm/uvm_vnode.c:1056 uvm_fault(fffffd807effe730,20001000,2,2) at uvm_fault+0x1197 sys/uvm/uvm_fault.c:1016 uvm_fault_wire(fffffd807effe730,20001000,20002000,2) at uvm_fault_wire+0x63 sys/uvm/uvm_fault.c:1285 uvm_map_pageable_wire(fffffd807effe730,fffffd803204d968,fffffd803204d4d0,5a4,ffffffff81a80d0e,0) at uvm_map_pageable_wire+0x30d sys/uvm/uvm_map.c:2367 sys_mlock(ffff8000ffffa9f8,ffff80002571e118,ffff80002571e160) at sys_mlock+0x180 sys/uvm/uvm_mmap.c:772 syscall(ffff80002571e1e0) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff80002571e1e0) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:589 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xa10c6265050, count: -14 ddb{0}> show registers rdi 0x3 rsi 0x40000 acpi_pdirpa+0x2be68 rbp 0xffff80002571d930 rbx 0x3 rdx 0xffff800000af7d80 rcx 0x3 rax 0x3ffff acpi_pdirpa+0x2be67 r8 0xffffffff81a7e9b3 witness_checkorder+0xf33 r9 0x5 r10 0x49ec22cc2a86a4ae r11 0x64e3c7c213a278af r12 0xffffffff8284c0b0 w_lodata+0x54430 r13 0 r14 0xffffffff8283a6d0 w_lodata+0x42a50 r15 0xfffffd8002c8f480 rip 0xffffffff82156c28 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff80002571d920 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.0) pid=462155 stat=onproc flags process=10 proc=4000000 pri=75, usrpri=75, nice=20 forw=0xffffffffffffffff, list=0xffff8000ffffa780,0xffff8000ffffb660 process=0xffff80002124d7b0 user=0xffff800025719000, vmspace=0xfffffd807effe730 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 63867 491266 82551 32767 7 0x10 syz-executor.0 *63867 462155 82551 32767 7 0x4000010 syz-executor.0 63867 277031 82551 32767 3 0x4000090 fsleep syz-executor.0 54898 32906 63440 32767 3 0x90 nanosleep syz-executor.1 82551 434991 21851 32767 3 0x90 nanosleep syz-executor.0 63440 433442 34496 0 3 0x82 wait syz-executor.1 21851 92657 34496 0 3 0x82 wait syz-executor.0 34496 423563 59825 0 3 0x82 thrsleep syz-fuzzer 34496 490755 59825 0 3 0x4000082 nanosleep syz-fuzzer 34496 407863 59825 0 3 0x4000082 kqread syz-fuzzer 34496 460710 59825 0 3 0x4000082 thrsleep syz-fuzzer 34496 500367 59825 0 3 0x4000082 thrsleep syz-fuzzer 34496 249158 59825 0 3 0x4000082 thrsleep syz-fuzzer 34496 79109 59825 0 3 0x4000082 thrsleep syz-fuzzer 34496 285574 59825 0 3 0x4000082 thrsleep syz-fuzzer 59825 498905 17610 0 3 0x10008a pause ksh 17610 451892 79832 0 3 0x92 select sshd 48572 104002 1 0 3 0x100083 ttyin getty 79832 140691 1 0 3 0x80 select sshd 65463 124975 44099 73 3 0x100090 kqread syslogd 44099 272761 1 0 3 0x100082 netio syslogd 71697 324448 1 77 3 0x100090 poll dhclient 74569 383675 1 0 3 0x80 poll dhclient 90080 132778 0 0 3 0x14200 bored smr 80617 69833 0 0 3 0x14200 pgzero zerothread 77560 353451 0 0 3 0x14200 aiodoned aiodoned 77816 389611 0 0 3 0x14200 syncer update 5613 340457 0 0 3 0x14200 cleaner cleaner 13360 9843 0 0 3 0x14200 reaper reaper 39709 139448 0 0 3 0x14200 pgdaemon pagedaemon 70759 29274 0 0 3 0x14200 bored crynlk 74925 515879 0 0 3 0x14200 bored crypto 49937 183370 0 0 3 0x40014200 acpi0 acpi0 50717 300554 0 0 3 0x40014200 idle1 77237 515438 0 0 3 0x14200 bored softnet 91481 97331 0 0 3 0x14200 bored systqmp 97289 276917 0 0 3 0x14200 bored systq 67288 29157 0 0 3 0x40014200 bored softclock 47215 394955 0 0 3 0x40014200 idle0 1 31253 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 63867 (syz-executor.0) thread 0xffff8000ffffa9f8 (462155) shared rwlock vmmaplk r = 0 (0xfffffd807effe748) #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 9464 6330K 6330K 78643K 10556 0 pcb 13 8K 8K 78643K 13 0 rtable 105 3K 3K 78643K 189 0 ifaddr 39 10K 10K 78643K 39 0 counters 43 33K 33K 78643K 43 0 ioctlops 0 0K 2K 78643K 76 0 iov 0 0K 12K 78643K 285 0 mount 1 1K 1K 78643K 1 0 vnodes 1217 77K 77K 78643K 1226 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 5K 78643K 4 0 VM map 2 1K 1K 78643K 2 0 sem 11 1K 1K 78643K 19 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1824 197K 290K 78643K 13058 0 file desc 8 25K 33K 78643K 18239 0 proc 48 50K 83K 78643K 369 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 8 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 43 201K 201K 78643K 43 0 exec 0 0K 2K 78643K 321 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 968 96K 97K 78643K 39999 0 UVM aobj 15 2K 2K 78643K 15 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 4394 0 NDP 5 0K 0K 78643K 9 0 temp 101 3961K 4025K 78643K 38569 0 kqueue 3 4K 8K 78643K 7 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 19 0 17 1 0 1 1 0 8 0 rtentry 112 45 0 1 2 0 2 2 0 8 0 unpcb 120 1892 0 1884 1 0 1 1 0 8 0 syncache 272 4 0 4 1 1 0 1 0 8 0 sackhl 24 2 0 2 2 2 0 1 0 8 0 tcpqe 32 70 0 70 1 1 0 1 0 8 0 tcpcb 592 2826 0 2811 15 13 2 7 0 8 0 inpcb 296 8015 0 8008 3 1 2 2 0 8 1 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 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 1 0 1 1 1 0 1 0 8 0 semupl 112 5 0 5 1 1 0 1 0 8 0 semapl 112 9 0 0 1 0 1 1 0 8 0 shmpl 112 12 0 0 1 0 1 1 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 19731 0 18333 88 0 88 88 0 8 0 ffsino 272 19731 0 18333 94 0 94 94 0 8 0 nchpl 144 45736 0 44136 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 126703 0 126703 3 2 1 1 0 8 1 percpumem 16 32 0 0 1 0 1 1 0 8 0 scxspl 192 114644 0 114644 15 14 1 7 0 8 1 plimitpl 152 20 0 11 1 0 1 1 0 8 0 sigapl 424 18426 0 18394 4 0 4 4 0 8 0 futexpl 56 133527 0 133526 1 0 1 1 0 8 0 knotepl 112 68 0 48 1 0 1 1 0 8 0 kqueuepl 152 18216 0 18209 1 0 1 1 0 8 0 pipepl 304 811 0 800 8 6 2 2 0 8 1 fdescpl 496 18411 0 18394 3 0 3 3 0 8 0 filepl 152 91657 0 91549 8 3 5 5 0 8 0 lockfpl 104 639 0 637 1 0 1 1 0 8 0 lockfspl 48 316 0 314 1 0 1 1 0 8 0 sessionpl 120 17 0 7 1 0 1 1 0 8 0 pgrppl 48 21 0 11 1 0 1 1 0 8 0 ucredpl 96 22587 0 22578 1 0 1 1 0 8 0 zombiepl 144 18395 0 18394 3 2 1 1 0 8 0 processpl 1008 18426 0 18394 6 1 5 5 0 8 0 procpl 632 37571 0 37530 5 1 4 5 0 8 0 sockpl 400 9937 0 9920 8 5 3 3 0 8 1 mcl64k 65536 17 0 0 3 0 3 3 0 8 0 mcl16k 16384 17 0 0 3 0 3 3 0 8 0 mcl12k 12288 18 0 0 2 0 2 2 0 8 0 mcl9k 9216 25 0 0 2 0 2 2 0 8 0 mcl8k 8192 12 0 0 2 0 2 2 0 8 0 mcl4k 4096 17 0 0 3 0 3 3 0 8 0 mcl2k2 2112 7 0 0 1 0 1 1 0 8 0 mcl2k 2048 274 0 0 26 3 23 26 0 8 0 mtagpl 96 1 0 0 1 0 1 1 0 8 0 mbufpl 256 721 0 0 27 0 27 27 0 8 0 bufpl 280 21632 0 15384 447 0 447 447 0 8 0 anonpl 16 1500685 0 1224398 1200 5 1195 1196 0 124 0 amapchunkpl 152 68025 0 61411 314 40 274 275 0 158 0 amappl16 192 39901 0 28325 579 0 579 579 0 8 0 amappl15 184 3 0 1 2 1 1 1 0 8 0 amappl14 176 29 0 20 1 0 1 1 0 8 0 amappl13 168 28 0 26 1 0 1 1 0 8 0 amappl12 160 22 0 15 1 0 1 1 0 8 0 amappl11 152 9140 0 9125 1 0 1 1 0 8 0 amappl10 144 9133 0 9127 1 0 1 1 0 8 0 amappl9 136 371 0 369 1 0 1 1 0 8 0 amappl8 128 158 0 110 2 0 2 2 0 8 0 amappl7 120 218 0 210 1 0 1 1 0 8 0 amappl6 112 9192 0 9176 1 0 1 1 0 8 0 amappl5 104 28139 0 28117 1 0 1 1 0 8 0 amappl4 96 308 0 284 1 0 1 1 0 8 0 amappl3 88 1397 0 1387 1 0 1 1 0 8 0 amappl2 80 128280 0 128208 2 0 2 2 0 8 0 amappl1 72 568162 0 567609 25 14 11 18 0 8 0 amappl 80 38674 0 37770 19 0 19 19 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 14 0 0 1 0 1 1 0 8 0 uaddrrnd 24 18411 0 18394 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 18411 0 18394 1 0 1 1 0 8 0 vmmpekpl 168 68732 0 68702 3 1 2 2 0 8 0 vmmpepl 168 2408906 0 2394980 1135 458 677 1121 0 357 71 vmsppl 368 18410 0 18394 2 0 2 2 0 8 0 pdppl 4096 36829 0 36788 6 0 6 6 0 8 0 pvpl 32 5246919 0 4967231 2438 23 2415 2429 0 265 0 pmappl 232 18410 0 18394 2 1 1 2 0 8 0 extentpl 40 53 0 36 1 0 1 1 0 8 0 phpool 112 284 0 13 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(fffffd80311622b8,9,0) at witness_checkorder+0xf5a witness_debugger sys/kern/subr_witness.c:2490 [inline] witness_checkorder(fffffd80311622b8,9,0) at witness_checkorder+0xf5a sys/kern/subr_witness.c:1087 rw_enter(fffffd80311622a8,81) at rw_enter+0xd4 rrw_enter(fffffd80311622a8,81) at rrw_enter+0x88 sys/kern/kern_rwlock.c:462 VOP_LOCK(fffffd806eede348,81) at VOP_LOCK+0x4b sys/kern/vfs_vops.c:614 vn_lock(fffffd806eede348,81) at vn_lock+0x6c sys/kern/vfs_vnops.c:575 uvn_io(fffffd806eee40d8,ffff80002571dcd8,1,2,0) at uvn_io+0x2b5 sys/uvm/uvm_vnode.c:1196 uvn_get(fffffd806eee40d8,8000000000001000,ffff80002571df30,ffff80002571decc,0,0) at uvn_get+0x226 sys/uvm/uvm_vnode.c:1056 uvm_fault(fffffd807effe730,20001000,2,2) at uvm_fault+0x1197 sys/uvm/uvm_fault.c:1016 uvm_fault_wire(fffffd807effe730,20001000,20002000,2) at uvm_fault_wire+0x63 sys/uvm/uvm_fault.c:1285 uvm_map_pageable_wire(fffffd807effe730,fffffd803204d968,fffffd803204d4d0,5a4,ffffffff81a80d0e,0) at uvm_map_pageable_wire+0x30d sys/uvm/uvm_map.c:2367 sys_mlock(ffff8000ffffa9f8,ffff80002571e118,ffff80002571e160) at sys_mlock+0x180 sys/uvm/uvm_mmap.c:772 syscall(ffff80002571e1e0) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff80002571e1e0) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:589 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xa10c6265050, 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(ffffffff82891e90) at __mp_lock+0x122 __mp_lock_spin sys/kern/kern_lock.c:116 [inline] __mp_lock(ffffffff82891e90) at __mp_lock+0x122 sys/kern/kern_lock.c:147 syscall(ffff8000234fa910) at syscall+0x3fd mi_syscall sys/sys/syscall_mi.h:93 [inline] syscall(ffff8000234fa910) at syscall+0x3fd sys/arch/amd64/amd64/trap.c:589 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffe3b60, count: -6