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 3/3] selftests/bpf: Test non-autoload rejection in light skeletons
Date: Wed, 25 Nov 2026 11:49:11 +1100 [thread overview]
Message-ID: <20261125004911.3937193-4-tweek@google.com> (raw)
In-Reply-To: <20261125004911.3937193-1-tweek@google.com>
Add a test (bpftool_gen/lskel_non_autoload) that invokes
'bpftool gen skeleton -L' on an object containing non-autoload
programs (test_global_percpu_data_failure.bpf.o) and verifies that
generation fails with the expected error message.
Signed-off-by: Thiébaud Weksteen <tweek@google.com>
---
.../selftests/bpf/prog_tests/bpftool_gen.c | 30 +++++++++++++++++++
1 file changed, 30 insertions(+)
create mode 100644 tools/testing/selftests/bpf/prog_tests/bpftool_gen.c
diff --git a/tools/testing/selftests/bpf/prog_tests/bpftool_gen.c b/tools/testing/selftests/bpf/prog_tests/bpftool_gen.c
new file mode 100644
index 000000000000..f0a0da6210df
--- /dev/null
+++ b/tools/testing/selftests/bpf/prog_tests/bpftool_gen.c
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include <bpftool_helpers.h>
+#include <test_progs.h>
+
+#define MAX_BPFTOOL_OUTPUT_LEN (64 * 1024)
+
+static char output[MAX_BPFTOOL_OUTPUT_LEN];
+
+static void test_lskel_non_autoload(void)
+{
+ char cmd[MAX_BPFTOOL_CMD_LEN];
+ int ret;
+
+ ret = snprintf(cmd, sizeof(cmd),
+ "gen skeleton -L test_global_percpu_data_failure.bpf.o 2>&1");
+ if (!ASSERT_GT(ret, 0, "format cmd"))
+ return;
+
+ ret = get_bpftool_command_output(cmd, output, sizeof(output));
+ ASSERT_NEQ(ret, 0, "gen skeleton -L non-autoload should fail");
+ ASSERT_HAS_SUBSTR(output,
+ "is marked as non-autoload, which is not supported for light skeletons",
+ "error message");
+}
+
+void test_bpftool_gen(void)
+{
+ if (test__start_subtest("lskel_non_autoload"))
+ test_lskel_non_autoload();
+}
--
2.56.1.831.g720f3f5937-goog
prev parent 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 [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 ` Thiébaud Weksteen [this message]
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-4-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