Thread View: muc.lists.freebsd.bugs
2 messages
2 total messages
Started by bugzilla-noreply
Tue, 24 Nov 2026 08:34
[Bug 301074] pf: NULL pointer dereference in pf_begin_eth() when /dev/pf is accessed concurrently with kldload pf
Author: bugzilla-noreply
Date: Tue, 24 Nov 2026 08:34
Date: Tue, 24 Nov 2026 08:34
126 lines
7015 bytes
7015 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301074
Bug ID: 301074
Summary: pf: NULL pointer dereference in pf_begin_eth() when
/dev/pf is accessed concurrently with kldload pf
Product: Base System
Version: 15.1-RELEASE
Hardware: amd64
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: kern
Assignee: bugs@FreeBSD.org
Reporter: hunreal@gmail.com
Environment:
FreeBSD 15.1-RELEASE-p7 releng/15.1-n283696-bb03631fe3b7 GENERIC amd64
CPU: Intel(R) Celeron(R) CPU J1900 @ 1.99GHz (4 cores), 8 GB RAM
Panic Details:
Fatal trap 12: page fault while in kernel mode
cpuid = 0; apic id = 00
fault virtual address = 0x0
fault code = supervisor read data, page not present
instruction pointer = 0x20:0xffffffff8516cd91
stack pointer = 0x28:0xfffffe008ae076a0
frame pointer = 0x28:0xfffffe008ae076c0
code segment = base 0x0, limit 0xfffff, type 0x1b
= DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags = interrupt enabled, resume, IOPL = 0
current process = 2353 (pfctl)
trap number = 12
panic: page fault
kgdb Analysis:
1. Crashing thread — Thread 100360 (PID 2353: pfctl):
#5 0xffffffff8109afcd in trap_fatal (...) at
/usr/src/sys/amd64/amd64/trap.c:1028
#6 0xffffffff8109afcd in trap_pfault (...)
#7 <signal handler called>
#8 0xffffffff8516cd91 in pf_begin_eth (ticket=0xfffffe00aa630404,
anchor=anchor@entry=0xfffffe00aa630004 "")
at /usr/src/sys/netpfil/pf/pf_ioctl.c:849
#9 0xffffffff85170741 in pfioctl (dev=<optimized out>, cmd=<optimized out>,
addr=0xfffffe008ae07d50 "\a", flags=<optimized out>, td=<optimized out>)
at /usr/src/sys/netpfil/pf/pf_ioctl.c:5424
#10 0xffffffff80a07e0b in devfs_ioctl (...) at
/usr/src/sys/fs/devfs/devfs_vnops.c:964
...
#15 kern_ioctl (..., com@entry=3222291537 /* DIOCXBEGIN */, ...)
at /usr/src/sys/kern/sys_generic.c:811
#16 sys_ioctl (...) at /usr/src/sys/kern/sys_generic.c:716
(kgdb) frame 8
849 TAILQ_FOREACH_SAFE(rule, rs->inactive.rules, entries,
(kgdb) x/6i $rip-10
0xffffffff8516cd8a <pf_begin_eth+26>: mov %rax,%r14
0xffffffff8516cd8d <pf_begin_eth+29>: mov 0x30(%rax),%rax
=> 0xffffffff8516cd91 <pf_begin_eth+33>: mov (%rax),%rdi
(kgdb) p rs
$rs = (struct pf_keth_ruleset *) 0xfffffe000e2fa9e0
(kgdb) p *rs
$1 = {rules = {{tqh_first = 0x0, tqh_last = 0x0},
{tqh_first = 0x0, tqh_last = 0x0}},
active = {rules = 0x0, open = 0, ticket = 0},
inactive = {rules = 0x0, open = 0, ticket = 0},
vnet = 0x0, anchor = 0x0}
(kgdb) frame 9
5424 if ((error = pf_begin_eth(&ioe->ticket, ioe->anchor))) {
(kgdb) p *io
$2 = {size = 7, esize = 1032, array = 0x2e4be86660c0}
(kgdb) p *ioe
$3 = {rs_num = 7, anchor = '\000' <repeats 1023 times>, ticket = 0}
The entire struct pf_keth_ruleset pointed to by rs is all zeroes, so
rs->inactive.rules is NULL and immediately faults at pf_ioctl.c:849.
2. Concurrent kldload thread on another CPU — Thread 100524 (PID 2344:
kldload):
#0 cpustop_handler () at /usr/src/sys/x86/x86/mp_x86.c:1535
#1 0xffffffff81067e08 in ipi_nmi_handler () at
/usr/src/sys/x86/x86/mp_x86.c:1492
#2 0xffffffff8105d31f in nmi_handle_intr (...) at
/usr/src/sys/x86/x86/cpu_machdep.c:1086
#3 <signal handler called>
#4 _mtx_init (c=c@entry=0xfffffe00ad1a2c20, name=<optimized out>,
type=type@entry=0x0, opts=opts@entry=0) at
/usr/src/sys/kern/kern_mutex.c:1192
#5 0xffffffff85142243 in pf_initialize () at
/usr/src/sys/netpfil/pf/pf.c:1237
#6 0xffffffff8516b189 in pfattach_vnet () at
/usr/src/sys/netpfil/pf/pf_ioctl.c:326
#7 pf_load_vnet () at /usr/src/sys/netpfil/pf/pf_ioctl.c:7076
#8 vnet_pf_init (unused=<optimized out>) at
/usr/src/sys/netpfil/pf/pf_ioctl.c:7212
#9 0xffffffff80cf306f in vnet_register_sysinit (
arg=0xffffffff851a1c30 <vnet_pf_init_vnet_init>) at
/usr/src/sys/net/vnet.c:548
#10 0xffffffff80b529af in linker_file_sysinit (lf=0xfffff800143cb900)
at /usr/src/sys/kern/kern_linker.c:242
#11 linker_load_file (filename=0xfffff800413178c0 "/boot/kernel/pf.ko",
result=<optimized out>) at /usr/src/sys/kern/kern_linker.c:501
#12 linker_load_module (kldname=kldname@entry=0x0,
modname=0xfffff8001452a000 "pf", ...) at
/usr/src/sys/kern/kern_linker.c:2294
#13 0xffffffff80b54585 in kern_kldload (...) at
/usr/src/sys/kern/kern_linker.c:1238
#14 0xffffffff80b54699 in sys_kldload (...) at
/usr/src/sys/kern/kern_linker.c:1261
--
You are receiving this mail because:
You are the assignee for the bug.
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
[Bug 301074] pf: NULL pointer dereference in pf_begin_eth() when /dev/pf is accessed concurrently with kldload pf
Author: bugzilla-noreply
Date: Tue, 24 Nov 2026 09:39
Date: Tue, 24 Nov 2026 09:39
16 lines
2544 bytes
2544 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301074
Mark Linimon <linimon@FreeBSD.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|bugs@FreeBSD.org |pf@FreeBSD.org
--
You are receiving this mail because:
You are the assignee for the bug.
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads