witness: lock order reversal: 1st 0xfffffd8068ce7b40 inode (&ip->i_lock) 2nd 0xffffffff8277e670 netlock (netlock) lock order "netlock"(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 vget+0x1c6 sys/kern/vfs_subr.c:671 #6 ktrwriteraw+0x138 sys/kern/kern_ktrace.c:659 #7 ktrstruct+0x169 ktrwrite2 sys/kern/kern_ktrace.c:627 [inline] #7 ktrstruct+0x169 sys/kern/kern_ktrace.c:311 #8 sys_connect+0x246 #9 syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] #9 syscall+0x4a1 sys/arch/amd64/amd64/trap.c:590 #10 Xsyscall+0x128 lock order "&ip->i_lock"(rrwlock) -> "netlock"(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_write+0x5b sys/kern/kern_rwlock.c:127 #2 uvn_get+0xeb uvm_vnode_lock sys/uvm/uvm_vnode.c:1501 [inline] #2 uvn_get+0xeb sys/uvm/uvm_vnode.c:993 #3 uvm_fault+0xa41 sys/uvm/uvm_fault.c:1073 #4 kpageflttrap+0x202 sys/arch/amd64/amd64/trap.c:265 #5 kerntrap+0xef sys/arch/amd64/amd64/trap.c:321 #6 alltraps_kern_meltdown+0x7b #7 copyin+0x53 #8 sys_connect+0x9b sys/kern/uipc_syscalls.c:362 #9 syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] #9 syscall+0x4a1 sys/arch/amd64/amd64/trap.c:590 #10 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(ffffffff8277e670,9,0) at witness_checkorder+0xf5a witness_debugger sys/kern/subr_witness.c:2490 [inline] witness_checkorder(ffffffff8277e670,9,0) at witness_checkorder+0xf5a sys/kern/subr_witness.c:1087 rw_enter_write(ffffffff8277e660) at rw_enter_write+0x5b sys/kern/kern_rwlock.c:127 uvn_get(fffffd8064f02ca8,0,ffff8000222ed6b8,ffff8000222ed654,0,1) at uvn_get+0xeb uvm_vnode_lock sys/uvm/uvm_vnode.c:1501 [inline] uvn_get(fffffd8064f02ca8,0,ffff8000222ed6b8,ffff8000222ed654,0,1) at uvn_get+0xeb sys/uvm/uvm_vnode.c:993 uvm_fault(fffffd807eff98a0,20000000,0,1) at uvm_fault+0xa41 sys/uvm/uvm_fault.c:1073 kpageflttrap(ffff8000222ed7e0,20000000) at kpageflttrap+0x202 sys/arch/amd64/amd64/trap.c:265 kerntrap(ffff8000222ed7e0) at kerntrap+0xef sys/arch/amd64/amd64/trap.c:321 alltraps_kern_meltdown() at alltraps_kern_meltdown+0x7b copyin() at copyin+0x53 sys_connect(ffff8000212722a8,ffff8000222ed9a8,ffff8000222ed9f0) at sys_connect+0x9b sys/kern/uipc_syscalls.c:362 syscall(ffff8000222eda70) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000222eda70) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:590 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x6d0edc16440, count: -12 ddb{0}> show registers rdi 0x3 rsi 0x40000 acpi_pdirpa+0x2be68 rbp 0xffff8000222ed320 rbx 0x3 rdx 0xffff800000b07340 rcx 0x3 rax 0x3ffff acpi_pdirpa+0x2be67 r8 0xffffffff81e34c43 witness_checkorder+0xf33 r9 0x5 r10 0xffec45f25de741cb r11 0x82118b2d55215bc4 r12 0xffffffff82845860 w_lodata+0x48ca0 r13 0 r14 0xffffffff82844ec0 w_lodata+0x48300 r15 0xfffffd8002c975c0 rip 0xffffffff82243a18 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff8000222ed310 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.0) pid=389302 stat=onproc flags process=0 proc=4000000 pri=32, usrpri=78, nice=20 forw=0xffffffffffffffff, list=0xffff800021273498,0xffffffff828e9418 process=0xffff800021236d70 user=0xffff8000222e8000, vmspace=0xfffffd807eff98a0 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 73292 194614 23009 0 2 0 syz-executor.0 *73292 389302 23009 0 7 0x4000000 syz-executor.0 84373 250748 40014 0 2 0 syz-executor.1 84373 276804 40014 0 3 0x4000080 fsleep syz-executor.1 72290 408157 0 0 3 0x14200 bored sosplice 40014 471561 89090 0 3 0x82 nanosleep syz-executor.1 23009 419330 89090 0 3 0x82 nanosleep syz-executor.0 89090 484892 13068 0 3 0x82 thrsleep syz-fuzzer 89090 455614 13068 0 3 0x4000082 nanosleep syz-fuzzer 89090 444683 13068 0 3 0x4000082 thrsleep syz-fuzzer 89090 95352 13068 0 3 0x4000082 thrsleep syz-fuzzer 89090 323816 13068 0 3 0x4000082 thrsleep syz-fuzzer 89090 358131 13068 0 3 0x4000082 thrsleep syz-fuzzer 89090 512590 13068 0 3 0x4000082 kqread syz-fuzzer 89090 443246 13068 0 3 0x4000082 thrsleep syz-fuzzer 13068 470961 28302 0 3 0x10008a pause ksh 28302 239873 3750 0 3 0x92 select sshd 28656 516120 1 0 3 0x100083 ttyin getty 3750 154257 1 0 3 0x80 select sshd 55267 457966 53648 74 3 0x100092 bpf pflogd 53648 407244 1 0 3 0x80 netio pflogd 64427 338192 96619 73 3 0x100090 kqread syslogd 96619 390814 1 0 3 0x100082 netio syslogd 66903 130439 1 77 3 0x100090 poll dhclient 54966 252250 1 0 3 0x80 poll dhclient 42609 403546 0 0 3 0x14200 bored smr 18722 201421 0 0 2 0x14200 zerothread 35009 188473 0 0 3 0x14200 aiodoned aiodoned 78392 365302 0 0 3 0x14200 syncer update 38061 261151 0 0 3 0x14200 cleaner cleaner 26850 267814 0 0 3 0x14200 reaper reaper 72383 113275 0 0 3 0x14200 pgdaemon pagedaemon 71029 14803 0 0 3 0x14200 bored crynlk 2873 371002 0 0 3 0x14200 bored crypto 87904 81536 0 0 3 0x14200 bored viomb 49533 479202 0 0 3 0x40014200 acpi0 acpi0 93292 358557 0 0 7 0x40014200 idle1 64890 199793 0 0 3 0x14200 bored softnet 31146 33853 0 0 3 0x14200 bored systqmp 4921 300688 0 0 3 0x14200 bored systq 72057 510018 0 0 3 0x40014200 bored softclock 43086 497144 0 0 3 0x40014200 idle0 1 86328 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks Process 73292 (syz-executor.0) thread 0xffff8000212722a8 (389302) exclusive rrwlock inode r = 0 (0xfffffd8068ce7b40) #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 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_get+0xd7 uvm_vnode_lock sys/uvm/uvm_vnode.c:1499 [inline] #5 uvn_get+0xd7 sys/uvm/uvm_vnode.c:993 #6 uvm_fault+0xa41 sys/uvm/uvm_fault.c:1073 #7 kpageflttrap+0x202 sys/arch/amd64/amd64/trap.c:265 #8 kerntrap+0xef sys/arch/amd64/amd64/trap.c:321 #9 alltraps_kern_meltdown+0x7b #10 copyin+0x53 #11 sys_connect+0x9b sys/kern/uipc_syscalls.c:362 #12 syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] #12 syscall+0x4a1 sys/arch/amd64/amd64/trap.c:590 #13 Xsyscall+0x128 exclusive kernel_lock &kernel_lock r = 1 (0xffffffff828cea78) #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:590 #2 Xsyscall+0x128 ddb{0}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 9522 6439K 7208K 78643K 11957 0 pcb 13 8K 8K 78643K 115 0 rtable 110 4K 5K 78643K 375 0 ifaddr 66 13K 13K 78643K 151 0 counters 43 33K 34K 78643K 79 0 ioctlops 0 0K 4K 78643K 1515 0 iov 0 0K 12K 78643K 33 0 mount 1 1K 1K 78643K 1 0 vnodes 1227 77K 77K 78643K 1620 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 1K 78643K 2 0 VM map 2 1K 1K 78643K 2 0 sem 9 0K 0K 78643K 15 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1825 197K 290K 78643K 13109 0 file desc 6 17K 25K 78643K 1329 0 sigio 0 0K 0K 78643K 20 0 proc 62 63K 95K 78643K 468 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 88 0 in_multi 33 2K 2K 78643K 50 0 ether_multi 1 0K 0K 78643K 21 0 mrt 0 0K 0K 78643K 46 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 358 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 129 24K 24K 78643K 3602 0 UVM aobj 5 4K 4K 78643K 5 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 62 0 NDP 11 0K 0K 78643K 33 0 temp 128 3964K 4028K 78643K 5597 0 kqueue 3 4K 8K 78643K 27 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 120 32 0 30 1 0 1 1 0 8 0 rtentry 112 62 0 18 2 0 2 2 0 8 0 unpcb 120 440 0 430 2 1 1 2 0 8 0 syncache 296 19 0 19 3 2 1 1 0 8 1 tcpqe 32 550 0 550 3 3 0 1 0 8 0 tcpcb 736 194 0 179 5 1 4 4 0 8 0 inpcb 296 568 0 550 3 1 2 2 0 8 0 rttmr 72 17 0 17 2 1 1 1 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 ppxss 1128 8 0 8 2 1 1 1 0 8 1 pfosfp 40 1428 0 1005 5 0 5 5 0 8 0 pfosfpen 112 1428 0 714 21 0 21 21 0 8 0 pfrktable 1344 3 0 1 1 0 1 1 0 8 0 pfstitem 24 25 0 13 1 0 1 1 0 8 0 pfstkey 112 25 0 13 1 0 1 1 0 8 0 pfstate 328 25 0 13 2 0 2 2 0 8 0 pfrule 1360 35 0 23 3 1 2 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 61 0 21 1 0 1 1 0 8 0 sysvmsgpl 40 19 0 2 1 0 1 1 0 8 0 semupl 112 6 0 6 2 2 0 1 0 8 0 semapl 112 7 0 0 1 0 1 1 0 8 0 shmpl 112 2 0 0 1 0 1 1 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 3023 0 1617 88 0 88 88 0 8 0 ffsino 272 3023 0 1617 95 1 94 94 0 8 0 nchpl 144 4681 0 3088 60 0 60 60 0 8 0 uvmvnodes 72 3350 0 0 61 0 61 61 0 8 0 vnodes 208 3350 0 0 177 0 177 177 0 8 0 namei 1024 11504 0 11504 2 1 1 1 0 8 1 percpumem 16 50 0 18 1 0 1 1 0 8 0 vcpupl 1984 5 0 0 1 0 1 1 0 8 0 vmpool 560 5 0 0 1 0 1 1 0 8 0 pfiaddrpl 120 7 0 0 1 0 1 1 0 8 0 scsiplug 72 5 0 5 1 1 0 1 0 8 0 scxspl 216 13792 0 13792 8 7 1 7 0 8 1 plimitpl 152 66 0 58 1 0 1 1 0 8 0 sigapl 424 1546 0 1512 4 0 4 4 0 8 0 futexpl 56 9259 0 9258 1 0 1 1 0 8 0 knotepl 112 89 0 69 1 0 1 1 0 8 0 kqueuepl 152 623 0 620 1 0 1 1 0 8 0 pipepl 304 193 0 182 6 5 1 3 0 8 0 fdescpl 496 1529 0 1512 3 0 3 3 0 8 0 filepl 152 5376 0 5271 8 3 5 7 0 8 0 lockfpl 104 158 0 157 1 0 1 1 0 8 0 lockfspl 48 74 0 73 1 0 1 1 0 8 0 sessionpl 144 18 0 7 1 0 1 1 0 8 0 pgrppl 48 18 0 7 1 0 1 1 0 8 0 ucredpl 96 494 0 485 1 0 1 1 0 8 0 zombiepl 144 1512 0 1512 2 1 1 1 0 8 1 processpl 1056 1546 0 1512 3 0 3 3 0 8 0 procpl 656 3015 0 2972 4 0 4 4 0 8 0 sosppl 168 8 0 8 1 1 0 1 0 8 0 sockpl 400 1040 0 1010 7 3 4 6 0 8 0 mcl64k 65536 9 0 0 2 0 2 2 0 8 0 mcl16k 16384 1 0 0 1 0 1 1 0 8 0 mcl12k 12288 2 0 0 1 0 1 1 0 8 0 mcl9k 9216 1 0 0 1 0 1 1 0 8 0 mcl8k 8192 2 0 0 1 0 1 1 0 8 0 mcl4k 4096 8 0 0 1 0 1 1 0 8 0 mcl2k 2048 227 0 0 28 0 28 28 0 8 0 mtagpl 96 150 0 0 4 0 4 4 0 8 0 mbufpl 256 512 0 0 30 0 30 30 0 8 0 bufpl 280 4932 0 181 340 0 340 340 0 8 0 anonpl 16 132344 0 116991 77 11 66 76 0 124 0 amapchunkpl 152 5532 0 5225 16 3 13 14 0 158 0 amappl16 192 5474 0 4808 44 7 37 44 0 8 0 amappl15 184 664 0 662 1 0 1 1 0 8 0 amappl14 176 29 0 21 1 0 1 1 0 8 0 amappl13 168 30 0 29 1 0 1 1 0 8 0 amappl12 160 7 0 5 3 2 1 1 0 8 0 amappl11 152 57 0 42 1 0 1 1 0 8 0 amappl10 144 651 0 646 1 0 1 1 0 8 0 amappl9 136 229 0 229 1 1 0 1 0 8 0 amappl8 128 143 0 107 2 0 2 2 0 8 0 amappl7 120 245 0 237 1 0 1 1 0 8 0 amappl6 112 699 0 687 1 0 1 1 0 8 0 amappl5 104 1944 0 1926 1 0 1 1 0 8 0 amappl4 96 290 0 262 1 0 1 1 0 8 0 amappl3 88 157 0 147 1 0 1 1 0 8 0 amappl2 80 10087 0 10015 3 0 3 3 0 8 0 amappl1 72 50312 0 49802 24 14 10 19 0 8 0 amappl 80 3292 0 3218 2 0 2 2 0 84 0 dma4096 4096 1 0 1 1 1 0 1 0 8 0 dma1024 1024 1 0 0 1 0 1 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 4 0 0 1 0 1 1 0 8 0 uaddrrnd 24 1534 0 1512 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 1534 0 1512 1 0 1 1 0 8 0 vmmpekpl 168 11457 0 11429 2 0 2 2 0 8 0 vmmpepl 168 195388 0 193346 113 21 92 98 0 357 0 vmsppl 368 1533 0 1512 2 0 2 2 0 8 0 pdppl 4096 3075 0 3029 65 19 46 46 0 8 0 pvpl 32 519609 0 502949 173 29 144 171 0 265 7 pmappl 232 1533 0 1512 3 1 2 2 0 8 0 extentpl 40 57 0 39 1 0 1 1 0 8 0 phpool 112 349 0 28 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(ffffffff8277e670,9,0) at witness_checkorder+0xf5a witness_debugger sys/kern/subr_witness.c:2490 [inline] witness_checkorder(ffffffff8277e670,9,0) at witness_checkorder+0xf5a sys/kern/subr_witness.c:1087 rw_enter_write(ffffffff8277e660) at rw_enter_write+0x5b sys/kern/kern_rwlock.c:127 uvn_get(fffffd8064f02ca8,0,ffff8000222ed6b8,ffff8000222ed654,0,1) at uvn_get+0xeb uvm_vnode_lock sys/uvm/uvm_vnode.c:1501 [inline] uvn_get(fffffd8064f02ca8,0,ffff8000222ed6b8,ffff8000222ed654,0,1) at uvn_get+0xeb sys/uvm/uvm_vnode.c:993 uvm_fault(fffffd807eff98a0,20000000,0,1) at uvm_fault+0xa41 sys/uvm/uvm_fault.c:1073 kpageflttrap(ffff8000222ed7e0,20000000) at kpageflttrap+0x202 sys/arch/amd64/amd64/trap.c:265 kerntrap(ffff8000222ed7e0) at kerntrap+0xef sys/arch/amd64/amd64/trap.c:321 alltraps_kern_meltdown() at alltraps_kern_meltdown+0x7b copyin() at copyin+0x53 sys_connect(ffff8000212722a8,ffff8000222ed9a8,ffff8000222ed9f0) at sys_connect+0x9b sys/kern/uipc_syscalls.c:362 syscall(ffff8000222eda70) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000222eda70) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:590 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x6d0edc16440, count: -12 ddb{0}> machine ddbcpu 1 Stopped at x86_ipi_db+0x1a: addq $0x8,%rsp ddb{1}> trace x86_ipi_db(ffff800020d68ff0) 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 acpicpu_idle() at acpicpu_idle+0x2eb sys/dev/acpi/acpicpu.c:1206 sched_idle(ffff800020d68ff0) at sched_idle+0x417 sys/kern/kern_sched.c:178 end trace frame: 0x0, count: -5