From: Eric Biggers <ebiggers@kernel.org>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: "Thiébaud Weksteen" <tweek@google.com>,
"Paul Moore" <paul@paul-moore.com>,
"Stephen Smalley" <stephen.smalley.work@gmail.com>,
"Alexei Starovoitov" <ast@kernel.org>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Jeffrey Vander Stoep" <jeffv@google.com>,
"Ondrej Mosnacek" <omosnace@redhat.com>,
"Eric Suen" <ericsu@linux.microsoft.com>,
"Blaise Boscaccy" <bboscaccy@linux.microsoft.com>,
"Sid Nayyar" <sidnayyar@google.com>,
"Neill Kapron" <nkapron@google.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"KP Singh" <kpsingh@kernel.org>,
bpf@vger.kernel.org, selinux@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next 0/5] bpf: Introduce LOADER_LOAD_FD
Date: Wed, 26 Aug 2026 20:09:16 +0000 [thread overview]
Message-ID: <20260826200916.GA3382628@google.com> (raw)
In-Reply-To: <39f53732-dc89-43b6-bf50-2ba5c64adf38@iogearbox.net>
On Mon, Aug 17, 2026 at 06:11:10PM +0200, Daniel Borkmann wrote:
> On 8/13/26 2:26 AM, Thiébaud Weksteen wrote:
> > The bpf subsystem supports a signed-bpf infrastructure to guarantee the
> > authenticity of programs [1, 2]. While this infrastructure is ideal for
> > dynamic environments or enterprise deployments where untrusted binaries
> > are loaded post-boot, it introduces unnecessary complexity for static
> > platform use cases.
> >
> > In the Android ecosystem, platform BPF programs reside exclusively on
> > read-only partitions that are strictly verified at the block level via
> > dm-verity. Because the kernel has already guaranteed the authenticity of
> > the underlying file, parsing and validating a secondary signature inside
> > the BPF subsystem is redundant, complex (because it requires X509 and
> > PKCS#7 parsing) and necessitates introducing additional signing flows
> > during build.
>
> Note that the BPF subsys doesn't implement any X.509 or PKCS#7 parsing,
> rather we reuse the same mechanism as the module loader has been using.
BPF made the mistake of using X.509 and PKCS#7 again, but that doesn't
mean it wasn't a mistake. These formats are highly complex, with each
"signature" actually being an ASN.1 object containing multiple
certificates and signatures for arbitrary algorithms, and many other
unnecessary complexities. The kernel's X.509, PKCS#7, and ASN.1 code
has had regular bugs ever since it was added to the kernel over a decade
ago. Just in the last week two more vulnerabilities have gone by:
https://lore.kernel.org/all/20260821192502.3942767-2-Jeremy.Jean@oss.cyber.gouv.fr/
and
https://lore.kernel.org/all/20260822212703.1019792-2-Jeremy.Jean@oss.cyber.gouv.fr/
Just because it's not in the BPF subsystem doesn't mean it's not BPF's
responsibility for choosing to depend on this unsupportable code.
I've mostly given up even trying to review X.509 and PKCS#7 kernel
patches, as they are difficult to understand and have little to do with
actual cryptography. And anyone building a secure system shouldn't be
using them anyway. It's nearly impossible to implement these data
formats correctly; it's best left for userspace libraries that
absolutely *have* to support these formats and have better testing and
fuzzing tools available.
These formats are not necessary to do signatures either, as the
signature algorithms can just be used directly, e.g.
https://docs.kernel.org/crypto/libcrypto-signature.html#ml-dsa
But in most cases module authentication has never needed signatures in
the first place, as either hash-based authentication
(https://lore.kernel.org/linux-modules/20260505-module-hashes-v5-0-e174a5a49fce@weissschuh.net/)
could be used, or modules can be trusted based on being loaded from a
filesystem that is already authenticated itself.
We should start moving on from the mistake of building X.509 and PKCS#7
based systems in the kernel. It's not working.
If there is a use case for authenticating BPF programs based on where
they are loaded from, that seems very reasonable to support directly
instead of forcing the use of unnecessary signatures and data formats.
- Eric
prev parent reply other threads:[~2026-08-26 20:09 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 0:26 [PATCH bpf-next 0/5] bpf: Introduce LOADER_LOAD_FD Thiébaud Weksteen
2026-08-13 0:26 ` [PATCH bpf-next 1/5] fs/kernel_read_file,selinux: Add BPF_LOADER constant Thiébaud Weksteen
2026-08-13 0:36 ` sashiko-bot
2026-08-13 1:25 ` bot+bpf-ci
2026-08-13 0:26 ` [PATCH bpf-next 2/5] bpf: Introduce BPF_LOADER_LOAD_FD command Thiébaud Weksteen
2026-08-13 0:42 ` sashiko-bot
2026-08-13 1:40 ` bot+bpf-ci
2026-08-13 0:26 ` [PATCH bpf-next 3/5] selinux: use kernel sid in security_bpf_* Thiébaud Weksteen
2026-08-13 0:40 ` sashiko-bot
2026-08-13 1:25 ` bot+bpf-ci
2026-08-13 0:26 ` [PATCH bpf-next 4/5] selinux: Add BPF_LOADER_LOAD_FD syscall permission Thiébaud Weksteen
2026-08-13 0:41 ` sashiko-bot
2026-08-13 0:26 ` [PATCH bpf-next 5/5] selftests/bpf: add loader_load_fd tests Thiébaud Weksteen
2026-08-13 0:36 ` sashiko-bot
2026-08-13 1:25 ` bot+bpf-ci
2026-08-17 16:11 ` [PATCH bpf-next 0/5] bpf: Introduce LOADER_LOAD_FD Daniel Borkmann
2026-08-26 20:09 ` Eric Biggers [this message]
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=20260826200916.GA3382628@google.com \
--to=ebiggers@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bboscaccy@linux.microsoft.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=ericsu@linux.microsoft.com \
--cc=gregkh@linuxfoundation.org \
--cc=jeffv@google.com \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nkapron@google.com \
--cc=omosnace@redhat.com \
--cc=paul@paul-moore.com \
--cc=selinux@vger.kernel.org \
--cc=sidnayyar@google.com \
--cc=stephen.smalley.work@gmail.com \
--cc=tweek@google.com \
/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