summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/testing_helpers.c
diff options
context:
space:
mode:
authorKui-Feng Lee <thinker.li@gmail.com>2024-02-21 18:11:05 -0800
committerMartin KaFai Lau <martin.lau@kernel.org>2024-02-22 12:26:41 -0800
commite9bbda13a7b876451285ab15fb600b809e5e2290 (patch)
tree5c5951094ff327b9e52343e25707d5cc944f2fdb /tools/testing/selftests/bpf/testing_helpers.c
parent3e0008336ae3153fb89b1a15bb877ddd38680fe6 (diff)
downloadlwn-e9bbda13a7b876451285ab15fb600b809e5e2290.tar.gz
lwn-e9bbda13a7b876451285ab15fb600b809e5e2290.zip
selftests/bpf: Test case for lacking CFI stub functions.
Ensure struct_ops rejects the registration of struct_ops types without proper CFI stub functions. bpf_test_no_cfi.ko is a module that attempts to register a struct_ops type called "bpf_test_no_cfi_ops" with cfi_stubs of NULL and non-NULL value. The NULL one should fail, and the non-NULL one should succeed. The module can only be loaded successfully if these registrations yield the expected results. Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com> Link: https://lore.kernel.org/r/20240222021105.1180475-3-thinker.li@gmail.com Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/testing_helpers.c')
-rw-r--r--tools/testing/selftests/bpf/testing_helpers.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/bpf/testing_helpers.c b/tools/testing/selftests/bpf/testing_helpers.c
index a59e56d804ee..28b6646662af 100644
--- a/tools/testing/selftests/bpf/testing_helpers.c
+++ b/tools/testing/selftests/bpf/testing_helpers.c
@@ -356,12 +356,12 @@ __u64 read_perf_max_sample_freq(void)
return sample_freq;
}
-static int finit_module(int fd, const char *param_values, int flags)
+int finit_module(int fd, const char *param_values, int flags)
{
return syscall(__NR_finit_module, fd, param_values, flags);
}
-static int delete_module(const char *name, int flags)
+int delete_module(const char *name, int flags)
{
return syscall(__NR_delete_module, name, flags);
}