From: "Kumar Kartikeya Dwivedi" <memxor@gmail.com>
To: "Jérémy Jean" <Jeremy.Jean@oss.cyber.gouv.fr>,
pablo@netfilter.org, fw@strlen.de
Cc: <phil@nwl.cc>, <netfilter-devel@vger.kernel.org>,
<coreteam@netfilter.org>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <bpf@vger.kernel.org>
Subject: Re: [PATCH] netfilter: bpf: disallow conntrack kfuncs for token programs
Date: Sun, 23 Aug 2026 21:12:12 +0200 [thread overview]
Message-ID: <DKWK8L9QBA37.2QGA0WNXIBV9C@gmail.com> (raw)
In-Reply-To: <20260822210945.1003967-2-Jeremy.Jean@oss.cyber.gouv.fr>
On Sat Aug 22, 2026 at 11:09 PM CEST, Jérémy Jean wrote:
> BPF tokens delegate BPF and network-admin capability checks to the token
> owning user namespace. Conntrack kfuncs nevertheless accept a network
> namespace ID relative to the program context without checking whether the
> token has authority over the resolved namespace.
>
> An XDP program attached to a veth in a child network namespace can use
> the peer namespace ID for init_net. bpf_xdp_ct_alloc() then allocates an
> entry in init_net, bpf_ct_insert_entry() publishes it, and the lookup and
> mutation kfuncs can subsequently access that host state.
>
> The verifier retains the token in prog->aux, but it cannot determine the
> runtime namespace selected through bpf_ct_opts. Conservatively reject the
> conntrack kfunc set for token-loaded programs. The kfunc interface is
> explicitly unstable, and ordinary token-authorized XDP programs remain
> available.
>
> Fixes: caf8f28e036c ("bpf: Add BPF token support to BPF_PROG_LOAD command")
> Assisted-by: Codex:gpt-5
> Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
So your solution is to just begin rejecting its use? Proper scoping and
containerization of programs is a bigger project that needs more thought.
It needs to be addressed properly across the API surface, we probably have
several other helpers/kfuncs that have similar ns-unaware behavior.
If we went on to simply reject each case programs using BPF tokens would
basically become useless.
pw-bot: cr
> [...]
next prev parent reply other threads:[~2026-08-23 19:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-22 21:09 [PATCH] netfilter: bpf: disallow conntrack kfuncs for token programs Jérémy Jean
2026-08-23 19:12 ` Kumar Kartikeya Dwivedi [this message]
2026-08-23 19:40 ` Jérémy Jean
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DKWK8L9QBA37.2QGA0WNXIBV9C@gmail.com \
--to=memxor@gmail.com \
--cc=Jeremy.Jean@oss.cyber.gouv.fr \
--cc=bpf@vger.kernel.org \
--cc=coreteam@netfilter.org \
--cc=fw@strlen.de \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=phil@nwl.cc \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox