Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/bpf: Remove usage of lsm/file_alloc_security in selftest

file_alloc_security hook is disabled. Use other LSM hooks in selftests
instead.

Signed-off-by: Amery Hung <ameryhung@gmail.com>
Link: https://lore.kernel.org/r/20251126202927.2584874-2-ameryhung@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Amery Hung and committed by
Alexei Starovoitov
a3a60cc1 b4bf1d23

+7 -7
+1 -1
tools/testing/selftests/bpf/prog_tests/test_lsm.c
··· 139 139 if (CHECK_FAIL(!err)) 140 140 goto close_prog; 141 141 142 - prog_fd = bpf_program__fd(skel->progs.lsm_file_alloc_security_prog); 142 + prog_fd = bpf_program__fd(skel->progs.lsm_kernfs_init_security_prog); 143 143 if (CHECK_FAIL(prog_fd < 0)) 144 144 goto close_prog; 145 145
+4 -4
tools/testing/selftests/bpf/progs/lsm_tailcall.c
··· 20 20 return 0; 21 21 } 22 22 23 - SEC("lsm/file_alloc_security") 24 - int lsm_file_alloc_security_prog(void *ctx) 23 + SEC("lsm/kernfs_init_security") 24 + int lsm_kernfs_init_security_prog(void *ctx) 25 25 { 26 26 return 0; 27 27 } 28 28 29 - SEC("lsm/file_alloc_security") 30 - int lsm_file_alloc_security_entry(void *ctx) 29 + SEC("lsm/kernfs_init_security") 30 + int lsm_kernfs_init_security_entry(void *ctx) 31 31 { 32 32 bpf_tail_call_static(ctx, &jmp_table, 0); 33 33 return 0;
+2 -2
tools/testing/selftests/bpf/progs/verifier_lsm.c
··· 4 4 #include <bpf/bpf_helpers.h> 5 5 #include "bpf_misc.h" 6 6 7 - SEC("lsm/file_alloc_security") 7 + SEC("lsm/file_permission") 8 8 __description("lsm bpf prog with -4095~0 retval. test 1") 9 9 __success 10 10 __naked int errno_zero_retval_test1(void *ctx) ··· 15 15 ::: __clobber_all); 16 16 } 17 17 18 - SEC("lsm/file_alloc_security") 18 + SEC("lsm/file_permission") 19 19 __description("lsm bpf prog with -4095~0 retval. test 2") 20 20 __success 21 21 __naked int errno_zero_retval_test2(void *ctx)