From: Eduard Zingerman <eddyz87@gmail.com>
To: bpf@vger.kernel.org, ast@kernel.org, andrii@kernel.org
Cc: daniel@iogearbox.net, martin.lau@linux.dev, kernel-team@fb.com,
yonghong.song@linux.dev, eddyz87@gmail.com, ctao@meta.com
Subject: [PATCH bpf-next v3 0/2] bpf: copy BPF token from main program to subprograms
Date: Wed, 15 Apr 2026 11:35:12 -0700 [thread overview]
Message-ID: <20260415-subprog-token-fix-v3-0-6fefe1d51646@gmail.com> (raw)
bpf_jit_subprogs() omits aux->token when it creates a struct
bpf_prog_aux instances for a subprograms.
This means that for programs loaded via BPF token (i.e., from a
non-init user namespace), subprograms fail the bpf_token_capable()
check in bpf_prog_kallsyms_add() and don't appear in /proc/kallsyms.
Which in-turn makes it impossible to freplace such subprograms.
Changelog:
v2 -> v3:
- mark selftest as serial (sashiko).
v1 -> v2:
- target bpf-next tree (fixups.c) instead of bpf tree (verifier.c).
v1: https://lore.kernel.org/bpf/20260414-subprog-token-fix-v1-0-5b1a38e01546@gmail.com/T/
v2: https://lore.kernel.org/bpf/20260414-subprog-token-fix-v2-0-59146c31f6f1@gmail.com/T/
---
Eduard Zingerman (2):
bpf: copy BPF token from main program to subprograms
selftests/bpf: verify kallsyms entries for token-loaded subprograms
kernel/bpf/fixups.c | 1 +
tools/testing/selftests/bpf/Makefile | 1 +
tools/testing/selftests/bpf/prog_tests/token.c | 83 +++++++++++++++++++++-
.../selftests/bpf/prog_tests/unpriv_bpf_disabled.c | 21 +-----
tools/testing/selftests/bpf/progs/token_kallsyms.c | 19 +++++
tools/testing/selftests/bpf/sysctl_helpers.c | 26 +++++++
tools/testing/selftests/bpf/sysctl_helpers.h | 7 ++
7 files changed, 135 insertions(+), 23 deletions(-)
---
base-commit: 71b500afd2f7336f5b6c6026f2af546fc079be26
change-id: 20260414-subprog-token-fix-96c29ffa7e12
next reply other threads:[~2026-04-15 18:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-15 18:35 Eduard Zingerman [this message]
2026-04-15 18:35 ` [PATCH bpf-next v3 1/2] bpf: copy BPF token from main program to subprograms Eduard Zingerman
2026-04-15 18:35 ` [PATCH bpf-next v3 2/2] selftests/bpf: verify kallsyms entries for token-loaded subprograms Eduard Zingerman
2026-04-15 19:17 ` sashiko-bot
2026-04-15 19:32 ` Eduard Zingerman
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=20260415-subprog-token-fix-v3-0-6fefe1d51646@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=ctao@meta.com \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=martin.lau@linux.dev \
--cc=yonghong.song@linux.dev \
/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