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{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: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(fffffd806a9ff248,ffff800021355108,1,202,0) at uvn_io+0x418 sys/uvm/uvm_vnode.c:1245
uvn_get(fffffd806a9ff248,0,ffff8000213551c8,ffff800021355198,0,0,728b7805ddd77fc6,1) at uvn_get+0x1df sys/uvm/uvm_vnode.c:1078
uvm_fault_lower(ffff800021355330,ffff800021355368,ffff8000213552b0,0) at uvm_fault_lower+0x36c sys/uvm/uvm_fault.c:1275
uvm_fault(fffffd807effc5c0,20001000,0,2) at uvm_fault+0x248
kpageflttrap(ffff8000213554c0,20001000) at kpageflttrap+0x209
kerntrap(ffff8000213554c0) 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,ffff800021355930,1,ffff8000212e6550) at pfioctl+0x4516 sys/net/pf_ioctl.c:2932
VOP_IOCTL(fffffd806f683c68,c0284457,ffff800021355930,1,fffffd807f7d7900,ffff8000212e6550) at VOP_IOCTL+0x96 sys/kern/vfs_vops.c:264
vn_ioctl(fffffd806e3fb8e8,c0284457,ffff800021355930,ffff8000212e6550) at vn_ioctl+0xbc sys/kern/vfs_vnops.c:531
sys_ioctl(ffff8000212e6550,ffff800021355a48,ffff800021355aa0) at sys_ioctl+0x4a2
syscall(ffff800021355b10) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline]
syscall(ffff800021355b10) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7ffffdf910, count: -17
ddb{0}> show registers
rdi 0x3
rsi 0xffffffff829b7950 __sancov_gen_cov_switch_values.134
rbp 0xffff800021354ed0
rbx 0x3
rdx 0x3fd
rcx 0
rax 0x1
r8 0xffff800021354e40
r9 0x8080808080808080
r10 0xaafa59bd3deae29c
r11 0xfe746535ca9ab6ec
r12 0xffffffff82b8e000 w_lodata+0x52cd0
r13 0
r14 0xffffffff82b89510 w_lodata+0x4e1e0
r15 0xfffffd8002f7a840
rip 0xffffffff818222c8 db_enter+0x18
cs 0x8
rflags 0x246
rsp 0xffff800021354ec0
ss 0x10
db_enter+0x18: addq $0x8,%rsp
ddb{0}> show proc
PROC (syz-executor.5) pid=184701 stat=onproc
flags process=0 proc=0
pri=17, usrpri=50, nice=20
forw=0xffffffffffffffff, list=0xffff8000212e6010,0xffffffff82a7cc20
process=0xffff8000213054e0 user=0xffff800021350000, vmspace=0xfffffd807effc5c0
estcpu=1, cpticks=0, pctcpu=0.0
user=0, sys=0, intr=0
ddb{0}> ps
PID TID PPID UID S FLAGS WAIT COMMAND
*58066 184701 48800 0 7 0 syz-executor.5
39930 224042 42201 0 2 0x2 ifconfig
42201 450431 48448 0 3 0x10008a sigsusp sh
99159 44917 7436 0 2 0x100002 sh
98254 524185 4563 0 2 0x100002 sh
50867 399899 99116 0 2 0x100000 sh
99116 274322 86221 0 3 0x10008a sigsusp sh
17339 11193 74186 0 2 0x40 syz-executor.2
78893 215308 35195 0 2 0x2 arp
56295 492673 43988 0 3 0x10008a sigsusp sh
35195 87114 49397 0 3 0x10008a sigsusp sh
4563 276564 22461 0 3 0x82 wait syz-executor.1
7436 83539 22461 0 3 0x82 wait syz-executor.7
48448 143670 22461 0 3 0x82 wait syz-executor.3
48800 158102 22461 0 3 0x82 nanoslp syz-executor.5
43988 489461 22461 0 3 0x82 wait syz-executor.0
74186 457921 22461 0 3 0x82 ppwait syz-executor.2
49397 127361 22461 0 3 0x82 wait syz-executor.6
86221 184379 22461 0 3 0x82 wait syz-executor.4
22461 62434 52763 0 3 0x82 thrsleep syz-execprog
22461 444433 52763 0 2 0x4000002 syz-execprog
22461 38942 52763 0 3 0x4000082 kqread syz-execprog
22461 77907 52763 0 3 0x4000082 thrsleep syz-execprog
22461 483389 52763 0 3 0x4000082 thrsleep syz-execprog
22461 423113 52763 0 3 0x4000082 thrsleep syz-execprog
22461 284915 52763 0 3 0x4000082 thrsleep syz-execprog
22461 293345 52763 0 3 0x4000082 thrsleep syz-execprog
22461 163802 52763 0 3 0x4000082 thrsleep syz-execprog
52763 519093 30776 0 3 0x10008a sigsusp ksh
30776 404518 51856 0 3 0x9a kqread sshd
28754 193768 1 0 3 0x100083 ttyin getty
51856 416293 1 0 3 0x88 kqread sshd
83328 470568 50085 74 3 0x1100092 bpf pflogd
50085 512558 1 0 3 0x80 netio pflogd
40097 406792 87668 73 3 0x1100090 kqread syslogd
87668 3330 1 0 3 0x100082 netio syslogd
74636 399225 1 0 3 0x100080 kqread resolvd
16711 186060 85083 77 3 0x100092 kqread dhcpleased
66774 96291 85083 77 3 0x100092 kqread dhcpleased
85083 252183 1 0 3 0x80 kqread dhcpleased
14741 361593 0 0 3 0x14200 bored smr
17859 10633 0 0 2 0x14200 zerothread
74720 503461 0 0 3 0x14200 aiodoned aiodoned
9527 236927 0 0 3 0x14200 syncer update
28826 392843 0 0 3 0x14200 cleaner cleaner
49847 76350 0 0 7 0x14200 reaper
54532 8065 0 0 3 0x14200 pgdaemon pagedaemon
27770 307973 0 0 3 0x14200 bored viomb
19903 344859 0 0 3 0x40014200 acpi0 acpi0
72663 51444 0 0 3 0x40014200 idle1
89294 253316 0 0 3 0x14200 bored softnet
47547 347230 0 0 3 0x14200 bored systqmp
74922 423042 0 0 3 0x14200 bored systq
95156 65780 0 0 3 0x40014200 bored softclock
77869 303897 0 0 3 0x40014200 idle0
1 316760 0 0 3 0x82 wait init
0 0 -1 0 3 0x10200 scheduler swapper
ddb{0}> show all locks
Process 58066 (syz-executor.5) thread 0xffff8000212e6550 (184701)
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{0}> 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 152 4K 4K 78643K 230 0
ifaddr 75 14K 14K 78643K 79 0
counters 56 35K 35K 78643K 56 0
ioctlops 0 0K 4K 78643K 1481 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 21 77K 97K 78643K 108 0
proc 74 103K 128K 78643K 471 0
NFS srvsock 1 0K 0K 78643K 1 0
NFS daemon 1 16K 16K 78643K 1 0
in_multi 45 3K 3K 78643K 45 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 607 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 163 73K 73K 78643K 2107 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 56 4714K 4777K 78643K 3326 0
kqueue 12 18K 18K 78643K 25 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
plcache 128 22 0 0 1 0 1 1 0 8 0
rtpcb 120 24 0 21 1 0 1 1 0 8 0
rtentry 112 70 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 1 0 1 1 0 8 1
tcpcb 736 8 0 5 1 0 1 1 0 8 0
arp 120 16 0 0 1 0 1 1 0 8 0
inpcb 312 59 0 52 1 0 1 1 0 8 0
nd6 48 6 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 11 0 0 1 0 1 1 0 8 0
pfstkey 112 11 0 0 1 0 1 1 0 8 0
pfstate 336 11 0 0 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 233 0 0 15 0 15 15 0 8 0
art_table 32 234 0 0 2 0 2 2 0 8 0
art_node 16 69 0 4 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 5822 0 5822 2 0 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 5334 0 5334 2 1 1 2 0 8 1
plimitpl 152 24 0 9 1 0 1 1 0 8 0
sigapl 424 415 0 365 6 0 6 6 0 8 0
knotepl 120 106 0 0 4 0 4 4 0 8 0
kqueuepl 216 21 0 13 1 0 1 1 0 8 0
pipepl 336 135 0 107 3 0 3 3 0 8 0
fdescpl 496 401 0 367 5 0 5 5 0 8 0
filepl 152 1528 0 1392 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 367 0 365 1 0 1 1 0 8 0
processpl 1064 415 0 365 4 0 4 4 0 8 0
procpl 672 423 0 365 6 0 6 6 0 8 0
sockpl 480 118 0 93 4 0 4 4 0 8 0
mcl8k 8192 4 0 0 1 0 1 1 0 8 0
mcl4k 4096 5 0 0 1 0 1 1 0 8 0
mcl2k 2048 56 0 0 7 0 7 7 0 8 0
mtagpl 96 2 0 0 1 0 1 1 0 8 0
mbufpl 256 232 0 0 14 0 14 14 0 8 0
bufpl 288 3611 0 149 248 0 248 248 0 8 0
anonpl 24 50571 0 45823 44 2 42 42 0 186 11
amapchunkpl 152 4302 0 3980 17 1 16 16 0 158 1
amappl16 200 320 0 238 5 0 5 5 0 8 0
amappl14 184 2 0 1 1 0 1 1 0 8 0
amappl13 176 96 0 84 1 0 1 1 0 8 0
amappl12 168 22 0 19 2 1 1 1 0 8 0
amappl11 160 98 0 76 1 0 1 1 0 8 0
amappl10 152 31 0 27 1 0 1 1 0 8 0
amappl9 144 464 0 461 1 0 1 1 0 8 0
amappl8 136 515 0 484 2 0 2 2 0 8 0
amappl7 128 106 0 96 1 0 1 1 0 8 0
amappl6 120 212 0 195 2 0 2 2 0 8 0
amappl5 112 107 0 92 1 0 1 1 0 8 0
amappl4 104 818 0 784 2 0 2 2 0 8 0
amappl3 96 493 0 446 2 0 2 2 0 8 0
amappl2 88 650 0 584 3 0 3 3 0 8 1
amappl1 80 11546 0 10888 21 1 20 20 0 8 5
amappl 88 1712 0 1606 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 401 0 367 1 0 1 1 0 8 0
uaddrbest 32 2 0 0 1 0 1 1 0 8 0
uaddr 24 401 0 367 1 0 1 1 0 8 0
vmmpekpl 168 8401 0 8374 2 0 2 2 0 8 0
vmmpepl 168 38319 0 36497 94 0 94 94 0 357 9
vmsppl 368 400 0 366 4 0 4 4 0 8 0
rwobjpl 56 12172 0 9623 41 0 41 41 0 8 4
pdppl 4096 809 0 732 103 18 85 85 0 8 8
pvpl 32 229444 0 220634 247 0 247 247 0 265 172
pmappl 248 400 0 366 3 0 3 3 0 8 0
extentpl 40 58 0 38 1 0 1 1 0 8 0
phpool 112 596 0 21 17 0 17 17 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: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(fffffd806a9ff248,ffff800021355108,1,202,0) at uvn_io+0x418 sys/uvm/uvm_vnode.c:1245
uvn_get(fffffd806a9ff248,0,ffff8000213551c8,ffff800021355198,0,0,728b7805ddd77fc6,1) at uvn_get+0x1df sys/uvm/uvm_vnode.c:1078
uvm_fault_lower(ffff800021355330,ffff800021355368,ffff8000213552b0,0) at uvm_fault_lower+0x36c sys/uvm/uvm_fault.c:1275
uvm_fault(fffffd807effc5c0,20001000,0,2) at uvm_fault+0x248
kpageflttrap(ffff8000213554c0,20001000) at kpageflttrap+0x209
kerntrap(ffff8000213554c0) 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,ffff800021355930,1,ffff8000212e6550) at pfioctl+0x4516 sys/net/pf_ioctl.c:2932
VOP_IOCTL(fffffd806f683c68,c0284457,ffff800021355930,1,fffffd807f7d7900,ffff8000212e6550) at VOP_IOCTL+0x96 sys/kern/vfs_vops.c:264
vn_ioctl(fffffd806e3fb8e8,c0284457,ffff800021355930,ffff8000212e6550) at vn_ioctl+0xbc sys/kern/vfs_vnops.c:531
sys_ioctl(ffff8000212e6550,ffff800021355a48,ffff800021355aa0) at sys_ioctl+0x4a2
syscall(ffff800021355b10) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline]
syscall(ffff800021355b10) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7ffffdf910, count: -17
ddb{0}> machine ddbcpu 1
Stopped at x86_ipi_db+0x1a: addq $0x8,%rsp
ddb{1}> trace
x86_ipi_db(ffff800020ce8ff0) 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
uvm_unmap_detach(ffff8000211357b0,1) at uvm_unmap_detach+0x113 sys/uvm/uvm_map.c:1615
uvm_map_teardown(fffffd806aab5460) at uvm_map_teardown+0x262 sys/uvm/uvm_map.c:2789
uvmspace_free(fffffd806aab5460) at uvmspace_free+0xa6 sys/uvm/uvm_map.c:3685
reaper(ffff8000210f9260) at reaper+0x19a sys/kern/kern_exit.c:454
end trace frame: 0x0, count: -8
ddb{1}>