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>,
"Emil Tsalapatis" <emil@etsalapatis.com>
Cc: Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Jiri Olsa <jolsa@kernel.org>,
Ihor Solodrai <ihor.solodrai@linux.dev>,
Sid Nayyar <sidnayyar@google.com>,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH bpf-next 2/2] bpftool: Reject non-autoload programs for light skeletons
Date: Mon, 7 Sep 2026 16:24:05 +0100 [thread overview]
Message-ID: <4468d220-9d7f-47d0-8e5c-c01070ab2d47@kernel.org> (raw)
In-Reply-To: <20260904031912.2133476-2-tweek@google.com>
On 04/09/2026 04:19, Thiébaud Weksteen wrote:
> When generating a light skeleton (bpftool gen skeleton -L), there is no
> libbpf runtime object or bpf_program__set_autoload() API available to
> enable/disable the autoloading of programs. If a BPF program in the
> object has autoload disabled (e.g. via SEC("?...")), bpf_object__load()
> silently skips loading it. bpftool still generates struct bpf_prog_desc
> fields and attach functions in the light skeleton header, leaving
> skel->progs.<name>.prog_fd uninitialized (0).
>
> Explicitly reject non-autoloaded programs when use_loader is true with
> an error message, preventing the generation of broken light skeleton
> headers.
>
> Signed-off-by: Thiébaud Weksteen <tweek@google.com>
> ---
> tools/bpf/bpftool/gen.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c
> index a50540ef6521..1583150241c8 100644
> --- a/tools/bpf/bpftool/gen.c
> +++ b/tools/bpf/bpftool/gen.c
> @@ -1340,6 +1340,12 @@ static int do_skeleton(int argc, char **argv)
> }
> bpf_object__for_each_program(prog, obj) {
> prog_cnt++;
> +
> + if (use_loader && !bpf_program__autoload(prog)) {
> + p_err("program '%s' is marked as non-autoload, which is not supported for light skeletons",
> + bpf_program__name(prog));
> + return -1;
Sashiko is correct, at this stage of the function, rather than returning
directly, you'd need to "goto out".
> + }
Thank you. Maybe consider adding a word about autoload/non-autoload in
"bpftool gen" man page? My concern is that users who are not familiar
with the notion will struggle to understand the error message.
Quentin
next prev parent reply other threads:[~2026-09-07 15:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 3:19 [PATCH bpf-next 1/2] selftests/bpf: Move verifier failure tests out of test_global_percpu_data Thiébaud Weksteen
2026-09-04 3:19 ` [PATCH bpf-next 2/2] bpftool: Reject non-autoload programs for light skeletons Thiébaud Weksteen
2026-09-04 4:13 ` bot+bpf-ci
2026-09-07 15:24 ` Quentin Monnet [this message]
2026-09-08 4:57 ` Thiébaud Weksteen
2026-09-04 6:07 ` [PATCH bpf-next 1/2] selftests/bpf: Move verifier failure tests out of test_global_percpu_data Leon Hwang
2026-09-07 5:46 ` Thiébaud Weksteen
2026-09-07 15:24 ` Leon Hwang
2026-09-08 1:04 ` 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=4468d220-9d7f-47d0-8e5c-c01070ab2d47@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-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®