BPF List
 help / color / mirror / Atom feed
From: "Thiébaud Weksteen" <tweek@google.com>
To: Quentin Monnet <qmo@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	 Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	 Eduard Zingerman <eddyz87@gmail.com>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	Shuah Khan <shuah@kernel.org>,  Leon Hwang <leon.hwang@linux.dev>
Cc: "Thiébaud Weksteen" <tweek@google.com>,
	bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
	"Martin KaFai Lau" <martin.lau@linux.dev>,
	"Song Liu" <song@kernel.org>,
	"Yonghong Song" <yonghong.song@linux.dev>,
	"Jiri Olsa" <jolsa@kernel.org>,
	"Emil Tsalapatis" <emil@etsalapatis.com>,
	"Ihor Solodrai" <ihor.solodrai@linux.dev>,
	"Sid Nayyar" <sidnayyar@google.com>
Subject: [PATCH bpf 0/3] bpftool: Reject non-autoload programs for light skeletons
Date: Wed, 25 Nov 2026 11:49:08 +1100	[thread overview]
Message-ID: <20261125004911.3937193-1-tweek@google.com> (raw)

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


             reply	other threads:[~2026-11-25  0:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  0:49 Thiébaud Weksteen [this message]
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

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=20261125004911.3937193-1-tweek@google.com \
    --to=tweek@google.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=jolsa@kernel.org \
    --cc=leon.hwang@linux.dev \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=qmo@kernel.org \
    --cc=shuah@kernel.org \
    --cc=sidnayyar@google.com \
    --cc=song@kernel.org \
    --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