NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/60688 (npf: wrong module/config dependency for bpf filter?)



> Date: Mon, 7 Sep 2026 12:06:42 -0400
> From: Thor Lancelot Simon <tls%panix.com@localhost>
> 
> Apologies - I had committed a mangled patch after test building in the wrong
> tree (sigh).  This should be fully fixed by npf_os.c 1.25, bpf.c 1.258, and
> bpg_filter.c 1.74.

Thanks, I'll take a look.

> The symptom is that a kernel without MODULAR nor pseudo-device bpfilter,
> but with pseudo-device npf, fails module initialization for built-in module
> npf:
> 
> WARNING: module error: Built-in module 'npf' prerequisite 'bpf' failed, error 2
> 
> Subsequently, "npfctl reload" will yield a quick panic because the module is
> uninitialized - the usual uvm_fault from a NULL pointer dereference.

That sounds like another bug with module loading.  If the module load
fails, `npfctl reload' should fail gracefully, not crash.

However, that's also consistent with bpf_ops being null.  Can you show
the stack trace?

> I don't think there is an issue with bpf_mtap2; it's a static inline from the
> bpf.h header file and is supplied by bpf_stub.c, not bpf.c.

Yes but it works via the global pointer bpf_ops which might be null if
something went wrong with module initialization, and the logic I see
in bpf_stub.c looks awfully sketchy at quick glance:

https://nxr.netbsd.org/xref/src/sys/net/bpf_stub.c?r=1.8



Home | Main Index | Thread Index | Old Index