Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Quentin Monnet <qmo@kernel.org>
To: "Thiébaud Weksteen" <tweek@google.com>,
	"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: 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: Re: [PATCH bpf 2/3] bpftool: Reject non-autoload programs for light skeletons
Date: Thu, 26 Nov 2026 15:34:06 +0000	[thread overview]
Message-ID: <8debe18f-e8f8-45d2-9c25-533fe1f15755@kernel.org> (raw)
In-Reply-To: <20261125004911.3937193-3-tweek@google.com>

2026-11-25 11:49 UTC+1100 ~ Thiébaud Weksteen <tweek@google.com>
> When generating a light skeleton (bpftool gen skeleton -L), there is no
> libbpf runtime object or bpf_program__set_autoload() API available to
> enable or disable program autoloading. If a BPF program in the object
> has autoload disabled (e.g. via SEC("?...")), bpf_object__load()
> silently skips loading it, while bpftool still emits struct
> bpf_prog_desc fields and attach/detach/destroy helpers for all programs.
> As a result, the loader program writes subsequent program FDs into
> preceding skeleton struct fields and leaves trailing prog_fd fields
> unpopulated (0).
> 
> Move bpf_object__gen_loader() and bpf_object__load() out of gen_trace()
> into do_skeleton() before validating programs and emitting skeleton
> struct definitions, so that any autoload state adjustments performed
> during bpf_object__load() (e.g. for struct_ops programs) are observed
> and no partial header is emitted on error. Explicitly reject any
> non-autoload program when use_loader is true with an error message, and
> document this restriction in bpftool-gen.rst.
> 
> Fixes: d510296d331a ("bpftool: Use syscall/loader program in "prog load" and "gen skeleton" command.")
> Signed-off-by: Thiébaud Weksteen <tweek@google.com>

Acked-by: Quentin Monnet <qmo@kernel.org>

Thank you

  reply	other threads:[~2026-11-26 15:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-26 15:33   ` Quentin Monnet
2026-11-25  0:49 ` [PATCH bpf 2/3] bpftool: Reject non-autoload programs for light skeletons Thiébaud Weksteen
2026-11-26 15:34   ` Quentin Monnet [this message]
2026-11-25  0:49 ` [PATCH bpf 3/3] selftests/bpf: Test non-autoload rejection in " Thiébaud Weksteen
2026-11-26 15:33   ` Quentin Monnet

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=8debe18f-e8f8-45d2-9c25-533fe1f15755@kernel.org \
    --to=qmo@kernel.org \
    --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=shuah@kernel.org \
    --cc=sidnayyar@google.com \
    --cc=song@kernel.org \
    --cc=tweek@google.com \
    --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