summaryrefslogtreecommitdiff
path: root/tools/lib/python
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2026-08-28 19:52:26 +0200
committerAlexei Starovoitov <ast@kernel.org>2026-08-29 18:17:51 -0700
commit1c8cb8bf73293264e2a44d0b029a5047a7dd5e20 (patch)
tree2e24ede380a262ca13aeb81d1ad846148dda02f8 /tools/lib/python
parentb638a82d64f1ee480c4b6c6c8e3da2ae84c1edb0 (diff)
downloadlinux-next-1c8cb8bf73293264e2a44d0b029a5047a7dd5e20.tar.gz
linux-next-1c8cb8bf73293264e2a44d0b029a5047a7dd5e20.zip
selftests/bpf: Add tests for bpf keyring in signed loader
bpf_keyring_provisioned walks the keyring through its whole lifecycle in one boot for ease of testing. It enrolls a freshly generated key into the bpf keyring, confirms a load is still refused with -ENOKEY while the keyring carries no restriction, then restricts it, and only then does the same signed BPF program load with the bpf keyring. A caller-supplied keyring is asserted to be refused both before and after the restriction, since what refuses it is bpf.keyring_unsealed=1 rather than the state of the keyring. Unsealing is a boot-time decision which also refuses the caller-supplied keyrings that most subtests here sign against, so each subtest is tagged with the boot it needs and the ones which cannot run report as skipped instead of being dropped. Regular run: # LDLIBS=-static PKG_CONFIG='pkg-config --static' ./vmtest.sh -- ./test_progs -t signed_loader [...] #425/12 signed_loader/signature_zero_size:OK #425/13 signed_loader/signature_bad_keyring:OK #425/14 signed_loader/bpf_keyring_sealed:OK [...] #425/30 signed_loader/signed_map_by_fd_rejected:OK #425/31 signed_loader/signed_sparse_fd_array_rejected:OK #425/32 signed_loader/bpf_keyring_provisioned:SKIP #425 signed_loader:OK (SKIP: 1/32) Summary: 1/31 PASSED, 1 SKIPPED, 0/0 FAILED Unsealed run: # KERNEL_CMDLINE_EXTRA="bpf.keyring_unsealed=1" \ LDLIBS=-static PKG_CONFIG='pkg-config --static' ./vmtest.sh -- ./test_progs -t signed_loader #425/1 signed_loader/loadtime_no_map:SKIP #425/2 signed_loader/loadtime_with_map:SKIP #425/3 signed_loader/metadata_match:OK [...] #425/30 signed_loader/signed_map_by_fd_rejected:SKIP #425/31 signed_loader/signed_sparse_fd_array_rejected:SKIP #425/32 signed_loader/bpf_keyring_provisioned:OK #425 signed_loader:OK (SKIP: 17/32) Summary: 1/15 PASSED, 17 SKIPPED, 0/0 FAILED Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/r/20260828175227.1537793-11-daniel@iogearbox.net Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions