witness: lock order reversal: 1st 0xffffffff82968010 pf_lock (pf_lock) 2nd 0xffffffff829323b0 netlock (netlock) lock order "netlock"(rwlock) -> "pf_lock"(rwlock) first seen at: #0 rw_enter_write+0x5b sys/kern/kern_rwlock.c:128 #1 pfioctl+0x417c sys/net/pf_ioctl.c:2964 #2 VOP_IOCTL+0x96 sys/kern/vfs_vops.c:264 #3 vn_ioctl+0xbc sys/kern/vfs_vnops.c:531 #4 sys_ioctl+0x4a2 #5 syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] #5 syscall+0x489 sys/arch/amd64/amd64/trap.c:585 #6 Xsyscall+0x128 lock order "pf_lock"(rwlock) -> "netlock"(rwlock) first seen at: #0 rw_enter_write+0x5b sys/kern/kern_rwlock.c:128 #1 uvn_io+0x418 sys/uvm/uvm_vnode.c:1245 #2 uvn_get+0x1df sys/uvm/uvm_vnode.c:1078 #3 uvm_fault_lower+0x36c sys/uvm/uvm_fault.c:1275 #4 uvm_fault+0x248 #5 kpageflttrap+0x209 #6 kerntrap+0xef sys/arch/amd64/amd64/trap.c:318 #7 alltraps_kern_meltdown+0x7b #8 copyout+0x53 #9 pfioctl+0x4516 sys/net/pf_ioctl.c:2932 #10 VOP_IOCTL+0x96 sys/kern/vfs_vops.c:264 #11 vn_ioctl+0xbc sys/kern/vfs_vnops.c:531 #12 sys_ioctl+0x4a2 #13 syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] #13 syscall+0x489 sys/arch/amd64/amd64/trap.c:585 #14 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:437 witness_checkorder(ffffffff829323b0,9,0) at witness_checkorder+0x10b7 witness_debugger sys/kern/subr_witness.c:2502 [inline] witness_checkorder(ffffffff829323b0,9,0) at witness_checkorder+0x10b7 sys/kern/subr_witness.c:1105 rw_enter_write(ffffffff829323a0) at rw_enter_write+0x5b sys/kern/kern_rwlock.c:128 uvn_io(fffffd806a965428,ffff80002133bcb8,1,202,0) at uvn_io+0x418 sys/uvm/uvm_vnode.c:1245 uvn_get(fffffd806a965428,0,ffff80002133bd78,ffff80002133bd48,0,0,46e50c7f6978464a,1) at uvn_get+0x1df sys/uvm/uvm_vnode.c:1078 uvm_fault_lower(ffff80002133bee0,ffff80002133bf18,ffff80002133be60,0) at uvm_fault_lower+0x36c sys/uvm/uvm_fault.c:1275 uvm_fault(fffffd807effc5c0,20001000,0,2) at uvm_fault+0x248 kpageflttrap(ffff80002133c070,20001000) at kpageflttrap+0x209 kerntrap(ffff80002133c070) at kerntrap+0xef sys/arch/amd64/amd64/trap.c:318 alltraps_kern_meltdown() at alltraps_kern_meltdown+0x7b copyout() at copyout+0x53 pfioctl(4900,c0284457,ffff80002133c4e0,1,ffff8000ffff4a90) at pfioctl+0x4516 sys/net/pf_ioctl.c:2932 VOP_IOCTL(fffffd806f6869c8,c0284457,ffff80002133c4e0,1,fffffd807f7d79c0,ffff8000ffff4a90) at VOP_IOCTL+0x96 sys/kern/vfs_vops.c:264 vn_ioctl(fffffd806c4f9980,c0284457,ffff80002133c4e0,ffff8000ffff4a90) at vn_ioctl+0xbc sys/kern/vfs_vnops.c:531 sys_ioctl(ffff8000ffff4a90,ffff80002133c5f8,ffff80002133c650) at sys_ioctl+0x4a2 syscall(ffff80002133c6c0) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff80002133c6c0) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7fffff58a0, count: -17 ddb{1}> show registers rdi 0x3 rsi 0xffffffff829b7950 __sancov_gen_cov_switch_values.134 rbp 0xffff80002133ba80 rbx 0x3 rdx 0x3fd rcx 0 rax 0x1 r8 0xffff80002133b9f0 r9 0x8080808080808080 r10 0x8020fa70a9a2b0d6 r11 0x2ee71abb8f746cc2 r12 0xffffffff82b8dc90 w_lodata+0x52960 r13 0 r14 0xffffffff82b895c0 w_lodata+0x4e290 r15 0xfffffd8002f7a840 rip 0xffffffff818222c8 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff80002133ba70 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{1}> show proc PROC (syz-executor.1) pid=33073 stat=onproc flags process=0 proc=0 pri=17, usrpri=50, nice=20 forw=0xffffffffffffffff, list=0xffff8000ffff5cf0,0xffffffff82a7cc20 process=0xffff8000212a29a8 user=0xffff800021337000, vmspace=0xfffffd807effc5c0 estcpu=0, cpticks=1, pctcpu=0.0 user=0, sys=1, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND *11454 33073 65918 0 7 0 syz-executor.1 58146 80029 5715 0 2 0x2 ndp 58425 197478 95945 0 2 0x2 sh 97551 389755 58479 0 7 0x100002 sh 8862 221266 78403 0 2 0x100002 sh 5715 219292 72441 0 3 0x10008a sigsusp sh 71090 356484 32757 0 2 0x2 ndp 81932 219934 16029 0 2 0x100002 sh 32757 479712 9514 0 3 0x10008a sigsusp sh 48736 45011 94548 0 2 0x100002 sh 16029 145180 28403 0 3 0x82 wait syz-executor.7 58479 46387 28403 0 3 0x82 wait syz-executor.2 72441 98894 28403 0 3 0x82 wait syz-executor.5 94548 160073 28403 0 3 0x82 wait syz-executor.3 95945 297153 28403 0 3 0x82 wait syz-executor.4 65918 360451 28403 0 3 0x82 nanoslp syz-executor.1 78403 448158 28403 0 3 0x82 wait syz-executor.6 9514 350589 28403 0 3 0x82 wait syz-executor.0 28403 274026 73209 0 3 0x82 thrsleep syz-execprog 28403 283490 73209 0 3 0x4000082 nanoslp syz-execprog 28403 32419 73209 0 2 0x4000002 syz-execprog 28403 232620 73209 0 3 0x4000082 thrsleep syz-execprog 28403 37702 73209 0 3 0x4000082 kqread syz-execprog 28403 429951 73209 0 3 0x4000082 thrsleep syz-execprog 28403 469938 73209 0 3 0x4000082 thrsleep syz-execprog 28403 97408 73209 0 3 0x4000082 thrsleep syz-execprog 28403 446398 73209 0 3 0x4000082 thrsleep syz-execprog 28403 522362 73209 0 3 0x4000082 thrsleep syz-execprog 73209 462051 37221 0 3 0x10008a sigsusp ksh 37221 260229 45363 0 3 0x9a kqread sshd 33932 157936 1 0 3 0x100083 ttyin getty 45363 330213 1 0 3 0x88 kqread sshd 877 405976 60773 74 3 0x1100092 bpf pflogd 60773 45482 1 0 3 0x80 netio pflogd 79092 117767 80119 73 3 0x1100090 kqread syslogd 80119 323355 1 0 3 0x100082 netio syslogd 31622 214174 1 0 3 0x100080 kqread resolvd 79207 252661 9688 77 3 0x100092 kqread dhcpleased 9927 175670 9688 77 3 0x100092 kqread dhcpleased 9688 115289 1 0 3 0x80 kqread dhcpleased 96227 518213 0 0 3 0x14200 bored smr 79591 178054 0 0 2 0x14200 zerothread 96725 464837 0 0 3 0x14200 aiodoned aiodoned 79606 167480 0 0 3 0x14200 syncer update 17096 520296 0 0 3 0x14200 cleaner cleaner 22930 256152 0 0 3 0x14200 reaper reaper 40270 21168 0 0 3 0x14200 pgdaemon pagedaemon 69252 285079 0 0 3 0x14200 bored viomb 67697 285038 0 0 3 0x40014200 acpi0 acpi0 90446 273254 0 0 3 0x40014200 idle1 17671 445804 0 0 3 0x14200 bored softnet 3320 209985 0 0 3 0x14200 bored systqmp 44770 145754 0 0 3 0x14200 bored systq 30927 461275 0 0 3 0x40014200 bored softclock 34270 475573 0 0 3 0x40014200 idle0 1 199190 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{1}> show all locks Process 11454 (syz-executor.1) thread 0xffff8000ffff4a90 (33073) exclusive rwlock pf_lock r = 0 (0xffffffff82968010) #0 witness_lock+0x44d #1 pfioctl+0x4504 sys/net/pf_ioctl.c:2931 #2 VOP_IOCTL+0x96 sys/kern/vfs_vops.c:264 #3 vn_ioctl+0xbc sys/kern/vfs_vnops.c:531 #4 sys_ioctl+0x4a2 #5 syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] #5 syscall+0x489 sys/arch/amd64/amd64/trap.c:585 #6 Xsyscall+0x128 shared rwlock pfioctl_rw r = 0 (0xffffffff82968070) #0 witness_lock+0x44d #1 pfioctl+0x946 sys/net/pf_ioctl.c:1150 #2 VOP_IOCTL+0x96 sys/kern/vfs_vops.c:264 #3 vn_ioctl+0xbc sys/kern/vfs_vnops.c:531 #4 sys_ioctl+0x4a2 #5 syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] #5 syscall+0x489 sys/arch/amd64/amd64/trap.c:585 #6 Xsyscall+0x128 exclusive kernel_lock &kernel_lock r = 0 (0xffffffff82ae5250) #0 witness_lock+0x44d #1 vn_ioctl+0x41 sys/kern/vfs_vnops.c:514 #2 sys_ioctl+0x4a2 #3 syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] #3 syscall+0x489 sys/arch/amd64/amd64/trap.c:585 #4 Xsyscall+0x128 ddb{1}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 10173 6473K 6473K 78643K 11263 0 pcb 13 8K 8K 78643K 13 0 rtable 172 4K 4K 78643K 258 0 ifaddr 78 15K 15K 78643K 82 0 counters 56 35K 35K 78643K 56 0 ioctlops 0 0K 4K 78643K 1483 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 5 0 vnodes 1167 73K 73K 78643K 1180 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 2 0K 0K 78643K 2 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1697 195K 286K 78643K 12548 0 file desc 20 73K 93K 78643K 117 0 proc 67 91K 115K 78643K 478 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 in_multi 59 3K 3K 78643K 59 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 25 122K 122K 78643K 25 0 exec 0 0K 2K 78643K 626 0 tdb 3 0K 0K 78643K 3 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 166 73K 74K 78643K 2154 0 UVM aobj 3 2K 2K 78643K 3 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 NDP 20 1K 1K 78643K 20 0 temp 56 4714K 4777K 78643K 3408 0 kqueue 12 18K 18K 78643K 25 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 plcache 128 22 0 0 1 0 1 1 0 8 0 rtpcb 120 27 0 23 1 0 1 1 0 8 0 rtentry 112 80 0 1 3 0 3 3 0 8 0 unpcb 136 35 0 20 1 0 1 1 0 8 0 syncache 296 5 0 5 2 1 1 1 0 8 1 tcpcb 736 8 0 5 1 0 1 1 0 8 0 arp 120 17 0 0 1 0 1 1 0 8 0 inpcb 312 60 0 54 1 0 1 1 0 8 0 nd6 48 10 0 0 1 0 1 1 0 8 0 pfosfp 40 1428 0 1005 5 0 5 5 0 8 0 pfosfpen 112 1428 0 714 21 0 21 21 0 8 0 pfstitem 24 13 0 2 1 0 1 1 0 8 0 pfstkey 112 13 0 2 1 0 1 1 0 8 0 pfstate 336 13 0 2 1 0 1 1 0 8 0 pfrule 1360 21 0 16 2 1 1 2 0 8 0 rttmrq 48 4 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 289 0 0 19 0 19 19 0 8 0 art_table 32 290 0 0 3 0 3 3 0 8 0 art_node 16 79 0 6 1 0 1 1 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 1481 0 49 90 0 90 90 0 8 0 ffsino 272 1481 0 49 96 0 96 96 0 8 0 nchpl 144 1745 0 59 63 0 63 63 0 8 0 uvmvnodes 80 1491 0 0 31 0 31 31 0 8 0 vnodes 224 1491 0 0 88 0 88 88 0 8 0 namei 1024 5885 0 5885 3 1 2 2 0 8 2 percpumem 16 40 0 0 1 0 1 1 0 8 0 kstatmem 264 24 0 0 2 0 2 2 0 8 0 scxspl 216 5544 0 5544 10 9 1 8 0 8 1 plimitpl 152 24 0 9 1 0 1 1 0 8 0 sigapl 424 424 0 377 6 0 6 6 0 8 0 knotepl 120 118 0 0 4 0 4 4 0 8 0 kqueuepl 216 21 0 13 1 0 1 1 0 8 0 pipepl 336 134 0 106 4 1 3 3 0 8 0 fdescpl 496 410 0 377 5 0 5 5 0 8 0 filepl 152 1537 0 1401 6 0 6 6 0 8 0 lockfpl 104 6 0 4 1 0 1 1 0 8 0 lockfspl 48 4 0 2 1 0 1 1 0 8 0 sessionpl 144 26 0 9 1 0 1 1 0 8 0 pgrppl 48 26 0 9 1 0 1 1 0 8 0 ucredpl 96 69 0 57 1 0 1 1 0 8 0 zombiepl 144 377 0 377 2 1 1 1 0 8 1 processpl 1064 424 0 377 4 0 4 4 0 8 0 procpl 672 433 0 377 6 0 6 6 0 8 0 sockpl 480 122 0 97 5 1 4 4 0 8 0 mcl8k 8192 6 0 0 1 0 1 1 0 8 0 mcl4k 4096 2 0 0 1 0 1 1 0 8 0 mcl2k 2048 57 0 0 8 0 8 8 0 8 0 mtagpl 96 3 0 0 1 0 1 1 0 8 0 mbufpl 256 214 0 0 13 0 13 13 0 8 0 bufpl 288 3604 0 143 248 0 248 248 0 8 0 anonpl 24 52046 0 47403 43 3 40 40 0 186 9 amapchunkpl 152 4410 0 4064 17 1 16 16 0 158 1 amappl16 200 308 0 228 5 0 5 5 0 8 0 amappl15 192 9 0 6 1 0 1 1 0 8 0 amappl14 184 5 0 5 1 0 1 1 0 8 1 amappl13 176 99 0 89 2 1 1 1 0 8 0 amappl12 168 6 0 4 2 1 1 1 0 8 0 amappl11 160 90 0 71 1 0 1 1 0 8 0 amappl10 152 48 0 41 1 0 1 1 0 8 0 amappl9 144 468 0 464 1 0 1 1 0 8 0 amappl8 136 513 0 486 3 1 2 2 0 8 0 amappl7 128 110 0 101 1 0 1 1 0 8 0 amappl6 120 233 0 216 2 0 2 2 0 8 1 amappl5 112 105 0 88 1 0 1 1 0 8 0 amappl4 104 812 0 782 2 0 2 2 0 8 0 amappl3 96 497 0 455 2 0 2 2 0 8 0 amappl2 88 671 0 606 3 0 3 3 0 8 1 amappl1 80 11761 0 11126 22 2 20 20 0 8 5 amappl 88 1746 0 1637 3 0 3 3 0 92 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 72 2 0 0 1 0 1 1 0 8 0 uaddrrnd 24 410 0 377 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 410 0 377 1 0 1 1 0 8 0 vmmpekpl 168 8494 0 8471 2 0 2 2 0 8 0 vmmpepl 168 39006 0 37289 95 3 92 92 0 357 9 vmsppl 368 409 0 377 4 0 4 4 0 8 1 rwobjpl 56 12418 0 9892 43 2 41 41 0 8 3 pdppl 4096 827 0 754 109 26 83 83 0 8 10 pvpl 32 233164 0 224454 245 4 241 241 0 265 164 pmappl 248 409 0 377 3 0 3 3 0 8 0 extentpl 40 58 0 38 1 0 1 1 0 8 0 phpool 112 608 0 31 17 0 17 17 0 8 0 ddb{1}> machine ddbcpu 0 Stopped at x86_ipi_db+0x1a: addq $0x8,%rsp ddb{0}> trace x86_ipi_db(ffffffff82960ff0) at x86_ipi_db+0x1a sys/arch/amd64/amd64/db_interface.c:393 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(ffffffff82ae5048) at __mp_lock+0x122 __mp_lock_spin sys/kern/kern_lock.c:116 [inline] __mp_lock(ffffffff82ae5048) at __mp_lock+0x122 sys/kern/kern_lock.c:147 intr_handler(ffff8000213482f0,ffff800000078500) at intr_handler+0x5e sys/arch/amd64/amd64/intr.c:532 Xintr_ioapic_edge16_untramp() at Xintr_ioapic_edge16_untramp+0x18f __sanitizer_cov_trace_pc() at __sanitizer_cov_trace_pc+0x39 sys/dev/kcov.c:154 softintr_dispatch(0) at softintr_dispatch+0x4e sys/arch/amd64/amd64/softintr.c:88 Xsoftclock() at Xsoftclock+0x1f __mp_lock(ffffffff82ae5048) at __mp_lock+0x129 __mp_lock_spin sys/kern/kern_lock.c:116 [inline] __mp_lock(ffffffff82ae5048) at __mp_lock+0x129 sys/kern/kern_lock.c:147 syscall(ffff800021348630) at syscall+0x3ef mi_syscall sys/sys/syscall_mi.h:93 [inline] syscall(ffff800021348630) at syscall+0x3ef sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffccd40, count: -12 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:437 witness_checkorder(ffffffff829323b0,9,0) at witness_checkorder+0x10b7 witness_debugger sys/kern/subr_witness.c:2502 [inline] witness_checkorder(ffffffff829323b0,9,0) at witness_checkorder+0x10b7 sys/kern/subr_witness.c:1105 rw_enter_write(ffffffff829323a0) at rw_enter_write+0x5b sys/kern/kern_rwlock.c:128 uvn_io(fffffd806a965428,ffff80002133bcb8,1,202,0) at uvn_io+0x418 sys/uvm/uvm_vnode.c:1245 uvn_get(fffffd806a965428,0,ffff80002133bd78,ffff80002133bd48,0,0,46e50c7f6978464a,1) at uvn_get+0x1df sys/uvm/uvm_vnode.c:1078 uvm_fault_lower(ffff80002133bee0,ffff80002133bf18,ffff80002133be60,0) at uvm_fault_lower+0x36c sys/uvm/uvm_fault.c:1275 uvm_fault(fffffd807effc5c0,20001000,0,2) at uvm_fault+0x248 kpageflttrap(ffff80002133c070,20001000) at kpageflttrap+0x209 kerntrap(ffff80002133c070) at kerntrap+0xef sys/arch/amd64/amd64/trap.c:318 alltraps_kern_meltdown() at alltraps_kern_meltdown+0x7b copyout() at copyout+0x53 pfioctl(4900,c0284457,ffff80002133c4e0,1,ffff8000ffff4a90) at pfioctl+0x4516 sys/net/pf_ioctl.c:2932 VOP_IOCTL(fffffd806f6869c8,c0284457,ffff80002133c4e0,1,fffffd807f7d79c0,ffff8000ffff4a90) at VOP_IOCTL+0x96 sys/kern/vfs_vops.c:264 vn_ioctl(fffffd806c4f9980,c0284457,ffff80002133c4e0,ffff8000ffff4a90) at vn_ioctl+0xbc sys/kern/vfs_vnops.c:531 sys_ioctl(ffff8000ffff4a90,ffff80002133c5f8,ffff80002133c650) at sys_ioctl+0x4a2 syscall(ffff80002133c6c0) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff80002133c6c0) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7fffff58a0, count: -17 ddb{1}>