BPF List
 help / color / mirror / Atom feed
* [PATCH bpf 0/3] bpftool: Reject non-autoload programs for light skeletons
@ 2026-11-25  0:49 Thiébaud Weksteen
  2026-11-25  0:49 ` [PATCH bpf 1/3] selftests/bpf: Move verifier failure tests out of test_global_percpu_data Thiébaud Weksteen
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Thiébaud Weksteen @ 2026-11-25  0:49 UTC (permalink / raw)
  To: Quentin Monnet, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Eduard Zingerman, Kumar Kartikeya Dwivedi,
	Shuah Khan, Leon Hwang
  Cc: Thiébaud Weksteen, bpf, linux-kselftest, Martin KaFai Lau,
	Song Liu, Yonghong Song, Jiri Olsa, Emil Tsalapatis,
	Ihor Solodrai, Sid Nayyar

When generating a light skeleton (bpftool gen skeleton -L),
bpf_object__load() skips non-autoload programs (e.g. SEC("?...")), but
bpftool still emits struct bpf_prog_desc and link fields for all
programs. This causes the loader program to store subsequent program FDs
into preceding struct fields and leave trailing prog_fd fields
unpopulated (0).

Following the discussion on the earlier "skip non-autoload programs"
series [1] and Andrii's feedback [2], this series returns to the initial
approach [3] of rejecting non-autoload programs when generating light
skeletons, while incorporating the prior review feedback (moving
bpf_object__gen_loader()/bpf_object__load() earlier in do_skeleton() so
post-load autoload adjustments are observed and documenting the
restriction in bpftool-gen.rst).

Supporting runtime toggling of non-autoload programs in light skeletons
was considered, but does not fit cleanly with signed light skeletons
where the attested loader blob should remain authoritative.

Patch 1 splits the two SEC("?kprobe") verifier failure tests out of
test_global_percpu_data.c (which is in LSKELS_EXTRA) before Patch 2
rejects them, so selftests continue to build at every commit. Patch 2
implements the rejection in bpftool. Patch 3 adds a selftest verifying
the rejection.

[1] https://lore.kernel.org/bpf/20260918040919.3402577-1-tweek@google.com/
[2] https://lore.kernel.org/bpf/CAEf4BzaeKXEC-gBbxo36wdAGwwZxqkL6pV=oo0dke4S2BmuRmg@mail.gmail.com/
[3] https://lore.kernel.org/bpf/20260904031912.2133476-2-tweek@google.com/

Thiébaud Weksteen (3):
  selftests/bpf: Move verifier failure tests out of
    test_global_percpu_data
  bpftool: Reject non-autoload programs for light skeletons
  selftests/bpf: Test non-autoload rejection in light skeletons

 .../bpf/bpftool/Documentation/bpftool-gen.rst |  4 +-
 tools/bpf/bpftool/gen.c                       | 68 +++++++++++--------
 .../selftests/bpf/prog_tests/bpftool_gen.c    | 30 ++++++++
 .../bpf/prog_tests/global_data_init.c         |  3 +-
 .../bpf/progs/test_global_percpu_data.c       | 23 -------
 .../progs/test_global_percpu_data_failure.c   | 30 ++++++++
 6 files changed, 106 insertions(+), 52 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/bpftool_gen.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_global_percpu_data_failure.c


base-commit: 84afebd853437e44cb71f718be11d90e4c1a59dd
-- 
2.56.1.831.g720f3f5937-goog


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

end of thread, other threads:[~2026-11-25  0:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25  0:49 [PATCH bpf 0/3] bpftool: Reject non-autoload programs for light skeletons Thiébaud Weksteen
2026-11-25  0:49 ` [PATCH bpf 1/3] selftests/bpf: Move verifier failure tests out of test_global_percpu_data Thiébaud Weksteen
2026-11-25  0:49 ` [PATCH bpf 2/3] bpftool: Reject non-autoload programs for light skeletons Thiébaud Weksteen
2026-11-25  0:59   ` sashiko-bot
2026-11-25  0:49 ` [PATCH bpf 3/3] selftests/bpf: Test non-autoload rejection in " Thiébaud Weksteen

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