aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/prog_tests/fentry_test.c
diff options
context:
space:
mode:
authorKP Singh <kpsingh@kernel.org>2025-09-21 18:01:20 +0200
committerAlexei Starovoitov <ast@kernel.org>2025-09-22 19:17:55 -0700
commitb720903e2b14d319268e1348a32c46a6fcbfd327 (patch)
tree7c515a2899b5858afee0304dc397806916b69eb3 /tools/testing/selftests/bpf/prog_tests/fentry_test.c
parentbpftool: Add support for signing BPF programs (diff)
downloadlinux-b720903e2b14d319268e1348a32c46a6fcbfd327.tar.gz
linux-b720903e2b14d319268e1348a32c46a6fcbfd327.zip
selftests/bpf: Enable signature verification for some lskel tests
The test harness uses the verify_sig_setup.sh to generate the required key material for program signing. Generate key material for signing LSKEL some lskel programs and use xxd to convert the verification certificate into a C header file. Finally, update the main test runner to load this certificate into the session keyring via the add_key() syscall before executing any tests. Use the session keyring in the tests with signed programs. Signed-off-by: KP Singh <kpsingh@kernel.org> Link: https://lore.kernel.org/r/20250921160120.9711-6-kpsingh@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/fentry_test.c')
-rw-r--r--tools/testing/selftests/bpf/prog_tests/fentry_test.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/fentry_test.c b/tools/testing/selftests/bpf/prog_tests/fentry_test.c
index aee1bc77a17f..ec882328eb59 100644
--- a/tools/testing/selftests/bpf/prog_tests/fentry_test.c
+++ b/tools/testing/selftests/bpf/prog_tests/fentry_test.c
@@ -43,8 +43,13 @@ static void fentry_test(void)
struct fentry_test_lskel *fentry_skel = NULL;
int err;
- fentry_skel = fentry_test_lskel__open_and_load();
- if (!ASSERT_OK_PTR(fentry_skel, "fentry_skel_load"))
+ fentry_skel = fentry_test_lskel__open();
+ if (!ASSERT_OK_PTR(fentry_skel, "fentry_skel_open"))
+ goto cleanup;
+
+ fentry_skel->keyring_id = KEY_SPEC_SESSION_KEYRING;
+ err = fentry_test_lskel__load(fentry_skel);
+ if (!ASSERT_OK(err, "fentry_skel_load"))
goto cleanup;
err = fentry_test_common(fentry_skel);