witness: lock order reversal: 1st 0xffffffff829bb660 pf_lock (pf_lock) 2nd 0xffffffff829701b0 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(ffffffff829701b0,9,0) at witness_checkorder+0x10b7 witness_debugger sys/kern/subr_witness.c:2502 [inline] witness_checkorder(ffffffff829701b0,9,0) at witness_checkorder+0x10b7 sys/kern/subr_witness.c:1105 rw_enter_write(ffffffff829701a0) at rw_enter_write+0x5b sys/kern/kern_rwlock.c:128 uvn_io(fffffd806c1b2248,ffff800021355ae8,1,202,0) at uvn_io+0x418 sys/uvm/uvm_vnode.c:1245 uvn_get(fffffd806c1b2248,0,ffff800021355ba8,ffff800021355b78,0,0,d87e9c90d9fb829d,1) at uvn_get+0x1df sys/uvm/uvm_vnode.c:1078 uvm_fault_lower(ffff800021355d10,ffff800021355d48,ffff800021355c90,0) at uvm_fault_lower+0x36c sys/uvm/uvm_fault.c:1275 uvm_fault(fffffd8071373018,20001000,0,2) at uvm_fault+0x248 kpageflttrap(ffff800021355ea0,20001000) at kpageflttrap+0x209 kerntrap(ffff800021355ea0) 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,ffff800021356310,1,ffff80002132ad30) at pfioctl+0x4516 sys/net/pf_ioctl.c:2932 VOP_IOCTL(fffffd806f67b488,c0284457,ffff800021356310,1,fffffd807f7d7720,ffff80002132ad30) at VOP_IOCTL+0x96 sys/kern/vfs_vops.c:264 vn_ioctl(fffffd8071a1dbe0,c0284457,ffff800021356310,ffff80002132ad30) at vn_ioctl+0xbc sys/kern/vfs_vnops.c:531 sys_ioctl(ffff80002132ad30,ffff800021356428,ffff800021356480) at sys_ioctl+0x4a2 syscall(ffff8000213564f0) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000213564f0) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7fffff1450, count: -17 ddb{1}> show registers rdi 0x3 rsi 0xffffffff8297c710 __sancov_gen_cov_switch_values.134 rbp 0xffff8000213558b0 rbx 0x3 rdx 0x3fd rcx 0 rax 0x1 r8 0xffff800021355820 r9 0x8080808080808080 r10 0xb256ff44f1dbc0d3 r11 0x5c91cae4d377ceea r12 0xffffffff82b113b0 w_lodata+0x52280 r13 0 r14 0xffffffff82b0cd90 w_lodata+0x4dc60 r15 0xfffffd8002f76840 rip 0xffffffff81ad9118 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff8000213558a0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{1}> show proc PROC (syz-executor.0) pid=219455 stat=onproc flags process=0 proc=0 pri=17, usrpri=51, nice=20 forw=0xffffffffffffffff, list=0xffff80002132b270,0xffff80002132a560 process=0xffff800021320440 user=0xffff800021351000, vmspace=0xfffffd8071373018 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{1}> ps PID TID PPID UID S FLAGS WAIT COMMAND 1439 454297 21914 0 2 0x100000 sh 37072 167257 84904 0 2 0x100000 sh *85293 219455 4676 0 7 0 syz-executor.0 15838 162320 96642 0 2 0x100002 sh 84904 92290 19984 0 3 0x10008a sigsusp sh 21914 55463 33991 0 3 0x10008a sigsusp sh 14497 226296 12290 0 7 0x100000 sh 91834 112979 13424 0 2 0x100000 sh 56230 78914 49060 0 2 0x2 ndp 49060 196085 52735 0 3 0x10008a sigsusp sh 70558 98011 91454 0 2 0x100002 sh 12290 386830 87725 0 3 0x10008a sigsusp sh 19984 319380 72326 0 3 0x82 wait syz-executor.6 13424 45524 26623 0 3 0x10008a sigsusp sh 91454 66340 72326 0 3 0x82 wait syz-executor.3 52735 519490 72326 0 3 0x82 wait syz-executor.7 87725 326515 72326 0 3 0x82 wait syz-executor.1 26623 55830 72326 0 3 0x82 wait syz-executor.5 33991 446396 72326 0 3 0x82 wait syz-executor.4 96642 416606 72326 0 3 0x82 wait syz-executor.2 4676 179325 72326 0 3 0x82 nanoslp syz-executor.0 72326 18289 35170 0 3 0x82 thrsleep syz-execprog 72326 410631 35170 0 3 0x4000082 nanoslp syz-execprog 72326 314736 35170 0 3 0x4000082 kqread syz-execprog 72326 149268 35170 0 3 0x4000082 thrsleep syz-execprog 72326 447472 35170 0 3 0x4000082 thrsleep syz-execprog 72326 363779 35170 0 3 0x4000082 thrsleep syz-execprog 72326 278452 35170 0 3 0x4000082 thrsleep syz-execprog 72326 125374 35170 0 3 0x4000082 thrsleep syz-execprog 72326 23869 35170 0 3 0x4000082 thrsleep syz-execprog 35170 211233 98431 0 3 0x10008a sigsusp ksh 98431 229728 51066 0 3 0x9a kqread sshd 61885 158023 1 0 3 0x100083 ttyin getty 51066 26652 1 0 3 0x88 kqread sshd 17820 128802 34874 74 3 0x1100092 bpf pflogd 34874 46836 1 0 3 0x80 netio pflogd 26854 36394 37536 73 3 0x1100090 kqread syslogd 37536 235151 1 0 3 0x100082 netio syslogd 71230 23168 1 0 3 0x100080 kqread resolvd 50505 465741 31705 77 3 0x100092 kqread dhcpleased 56393 498683 31705 77 3 0x100092 kqread dhcpleased 31705 43920 1 0 3 0x80 kqread dhcpleased 66455 134995 0 0 3 0x14200 bored smr 96236 436425 0 0 2 0x14200 zerothread 17767 303760 0 0 3 0x14200 aiodoned aiodoned 15765 94507 0 0 3 0x14200 syncer update 19122 405429 0 0 3 0x14200 cleaner cleaner 95396 427559 0 0 3 0x14200 reaper reaper 61772 54110 0 0 3 0x14200 pgdaemon pagedaemon 61647 274090 0 0 3 0x14200 bored viomb 97384 162096 0 0 3 0x40014200 acpi0 acpi0 36440 91092 0 0 3 0x40014200 idle1 26819 318611 0 0 3 0x14200 bored softnet 25684 305781 0 0 3 0x14200 bored systqmp 91457 113799 0 0 3 0x14200 bored systq 57510 523059 0 0 3 0x40014200 bored softclock 26197 38710 0 0 3 0x40014200 idle0 1 291675 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{1}> show all locks Process 85293 (syz-executor.0) thread 0xffff80002132ad30 (219455) exclusive rwlock pf_lock r = 0 (0xffffffff829bb660) #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 (0xffffffff829bb6c0) #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 (0xffffffff82b9a8a8) #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 10170 6471K 6471K 78643K 11260 0 pcb 13 8K 8K 78643K 13 0 rtable 140 3K 4K 78643K 216 0 ifaddr 70 14K 14K 78643K 74 0 counters 54 35K 35K 78643K 54 0 ioctlops 0 0K 4K 78643K 1482 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 4 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 23 85K 93K 78643K 102 0 proc 67 91K 115K 78643K 436 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 in_multi 47 3K 3K 78643K 47 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 606 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 170 72K 72K 78643K 2136 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 17 1K 1K 78643K 17 0 temp 52 4714K 4777K 78643K 3335 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 25 0 22 1 0 1 1 0 8 0 rtentry 112 64 0 1 2 0 2 2 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 12 0 0 1 0 1 1 0 8 0 inpcb 312 54 0 48 1 0 1 1 0 8 0 nd6 48 7 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 12 0 2 1 0 1 1 0 8 0 pfstkey 112 12 0 2 1 0 1 1 0 8 0 pfstate 336 12 0 2 1 0 1 1 0 8 0 pfrule 1360 21 0 15 2 0 2 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 241 0 0 16 0 16 16 0 8 0 art_table 32 242 0 0 2 0 2 2 0 8 0 art_node 16 63 0 5 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 5793 0 5793 3 1 2 2 0 8 2 percpumem 16 39 0 0 1 0 1 1 0 8 0 kstatmem 264 22 0 0 2 0 2 2 0 8 0 scxspl 216 5557 0 5557 10 9 1 8 0 8 1 plimitpl 152 24 0 9 1 0 1 1 0 8 0 sigapl 424 417 0 367 6 0 6 6 0 8 0 knotepl 120 120 0 0 4 0 4 4 0 8 0 kqueuepl 216 21 0 13 1 0 1 1 0 8 0 pipepl 336 137 0 109 4 1 3 3 0 8 0 fdescpl 496 403 0 367 5 0 5 5 0 8 0 filepl 152 1531 0 1395 6 0 6 6 0 8 0 lockfpl 104 7 0 4 1 0 1 1 0 8 0 lockfspl 48 5 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 367 0 367 2 1 1 1 0 8 1 processpl 1064 417 0 367 4 0 4 4 0 8 0 procpl 672 425 0 367 6 0 6 6 0 8 0 sockpl 480 114 0 90 5 1 4 4 0 8 0 mcl8k 8192 3 0 0 1 0 1 1 0 8 0 mcl4k 4096 4 0 0 1 0 1 1 0 8 0 mcl2k 2048 56 0 0 7 0 7 7 0 8 0 mtagpl 96 3 0 0 1 0 1 1 0 8 0 mbufpl 256 297 0 0 18 0 18 18 0 8 0 bufpl 288 3601 0 142 248 0 248 248 0 8 0 anonpl 24 51175 0 46364 45 5 40 41 0 186 8 amapchunkpl 152 4348 0 4009 16 1 15 15 0 158 1 amappl16 200 355 0 272 6 0 6 6 0 8 0 amappl15 192 22 0 18 1 0 1 1 0 8 0 amappl14 184 8 0 8 1 0 1 1 0 8 1 amappl13 176 85 0 75 2 1 1 1 0 8 0 amappl12 168 7 0 6 2 1 1 1 0 8 0 amappl11 160 92 0 71 1 0 1 1 0 8 0 amappl10 152 16 0 13 1 0 1 1 0 8 0 amappl9 144 471 0 467 1 0 1 1 0 8 0 amappl8 136 529 0 498 3 1 2 2 0 8 0 amappl7 128 92 0 83 1 0 1 1 0 8 0 amappl6 120 205 0 187 2 0 2 2 0 8 1 amappl5 112 106 0 92 1 0 1 1 0 8 0 amappl4 104 837 0 800 2 0 2 2 0 8 0 amappl3 96 495 0 448 2 0 2 2 0 8 0 amappl2 88 657 0 593 3 0 3 3 0 8 1 amappl1 80 11711 0 11032 22 2 20 20 0 8 5 amappl 88 1737 0 1623 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 403 0 367 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 403 0 367 1 0 1 1 0 8 0 vmmpekpl 168 8437 0 8409 2 0 2 2 0 8 0 vmmpepl 168 38521 0 36647 97 4 93 93 0 357 8 vmsppl 368 402 0 367 4 0 4 4 0 8 0 rwobjpl 56 12284 0 9733 42 1 41 41 0 8 3 pdppl 4096 813 0 734 111 28 83 83 0 8 4 pvpl 32 231078 0 221908 248 6 242 242 0 265 164 pmappl 248 402 0 367 3 0 3 3 0 8 0 extentpl 40 58 0 38 1 0 1 1 0 8 0 phpool 112 611 0 32 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(ffffffff8298fff0) 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(ffffffff82b9a6a0) at __mp_lock+0x122 __mp_lock_spin sys/kern/kern_lock.c:116 [inline] __mp_lock(ffffffff82b9a6a0) at __mp_lock+0x122 sys/kern/kern_lock.c:147 intr_handler(ffff800021362ae0,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+0xb sys/dev/kcov.c:144 softintr_dispatch(0) at softintr_dispatch+0x4e sys/arch/amd64/amd64/softintr.c:88 Xsoftclock() at Xsoftclock+0x1f __sanitizer_cov_trace_pc() at __sanitizer_cov_trace_pc+0x16 kd_curproc sys/dev/kcov.c:574 [inline] __sanitizer_cov_trace_pc() at __sanitizer_cov_trace_pc+0x16 sys/dev/kcov.c:148 __mp_lock(ffffffff82b9a6a0) at __mp_lock+0x133 __mp_lock_spin sys/kern/kern_lock.c:116 [inline] __mp_lock(ffffffff82b9a6a0) at __mp_lock+0x133 sys/kern/kern_lock.c:147 syscall(ffff800021362e30) at syscall+0x3ef mi_syscall sys/sys/syscall_mi.h:93 [inline] syscall(ffff800021362e30) at syscall+0x3ef sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7ffffc2e20, count: -13 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(ffffffff829701b0,9,0) at witness_checkorder+0x10b7 witness_debugger sys/kern/subr_witness.c:2502 [inline] witness_checkorder(ffffffff829701b0,9,0) at witness_checkorder+0x10b7 sys/kern/subr_witness.c:1105 rw_enter_write(ffffffff829701a0) at rw_enter_write+0x5b sys/kern/kern_rwlock.c:128 uvn_io(fffffd806c1b2248,ffff800021355ae8,1,202,0) at uvn_io+0x418 sys/uvm/uvm_vnode.c:1245 uvn_get(fffffd806c1b2248,0,ffff800021355ba8,ffff800021355b78,0,0,d87e9c90d9fb829d,1) at uvn_get+0x1df sys/uvm/uvm_vnode.c:1078 uvm_fault_lower(ffff800021355d10,ffff800021355d48,ffff800021355c90,0) at uvm_fault_lower+0x36c sys/uvm/uvm_fault.c:1275 uvm_fault(fffffd8071373018,20001000,0,2) at uvm_fault+0x248 kpageflttrap(ffff800021355ea0,20001000) at kpageflttrap+0x209 kerntrap(ffff800021355ea0) 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,ffff800021356310,1,ffff80002132ad30) at pfioctl+0x4516 sys/net/pf_ioctl.c:2932 VOP_IOCTL(fffffd806f67b488,c0284457,ffff800021356310,1,fffffd807f7d7720,ffff80002132ad30) at VOP_IOCTL+0x96 sys/kern/vfs_vops.c:264 vn_ioctl(fffffd8071a1dbe0,c0284457,ffff800021356310,ffff80002132ad30) at vn_ioctl+0xbc sys/kern/vfs_vnops.c:531 sys_ioctl(ffff80002132ad30,ffff800021356428,ffff800021356480) at sys_ioctl+0x4a2 syscall(ffff8000213564f0) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff8000213564f0) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x7f7fffff1450, count: -17 ddb{1}>