public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next v2 0/2] bpf: copy BPF token from main program to subprograms
@ 2026-04-15  0:30 Eduard Zingerman
  2026-04-15  0:30 ` [PATCH bpf-next v2 1/2] " Eduard Zingerman
  2026-04-15  0:30 ` [PATCH bpf-next v2 2/2] selftests/bpf: verify kallsyms entries for token-loaded subprograms Eduard Zingerman
  0 siblings, 2 replies; 7+ messages in thread
From: Eduard Zingerman @ 2026-04-15  0:30 UTC (permalink / raw)
  To: bpf, ast, andrii
  Cc: daniel, martin.lau, kernel-team, yonghong.song, eddyz87, ctao

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:
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/
---
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     | 81 +++++++++++++++++++++-
 .../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, 134 insertions(+), 22 deletions(-)
---
base-commit: 71b500afd2f7336f5b6c6026f2af546fc079be26
change-id: 20260414-subprog-token-fix-96c29ffa7e12

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-04-15 18:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-15  0:30 [PATCH bpf-next v2 0/2] bpf: copy BPF token from main program to subprograms Eduard Zingerman
2026-04-15  0:30 ` [PATCH bpf-next v2 1/2] " Eduard Zingerman
2026-04-15  1:08   ` sashiko-bot
2026-04-15 18:30     ` Eduard Zingerman
2026-04-15  0:30 ` [PATCH bpf-next v2 2/2] selftests/bpf: verify kallsyms entries for token-loaded subprograms Eduard Zingerman
2026-04-15  1:21   ` sashiko-bot
2026-04-15  5:55     ` Eduard Zingerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox