mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-24 01:54:01 -05:00
selftests/bpf: Add selftest for attaching fexit to __noreturn functions
The reuslt: $ tools/testing/selftests/bpf/test_progs --name=fexit_noreturns #99/1 fexit_noreturns/noreturns:OK #99 fexit_noreturns:OK Summary: 1/1 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Yafang Shao <laoar.shao@gmail.com> Link: https://lore.kernel.org/r/20250318114447.75484-3-laoar.shao@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
committed by
Alexei Starovoitov
parent
cfe816d469
commit
be16ddeaae
9
tools/testing/selftests/bpf/prog_tests/fexit_noreturns.c
Normal file
9
tools/testing/selftests/bpf/prog_tests/fexit_noreturns.c
Normal file
@@ -0,0 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
#include <test_progs.h>
|
||||
#include "fexit_noreturns.skel.h"
|
||||
|
||||
void test_fexit_noreturns(void)
|
||||
{
|
||||
RUN_TESTS(fexit_noreturns);
|
||||
}
|
||||
15
tools/testing/selftests/bpf/progs/fexit_noreturns.c
Normal file
15
tools/testing/selftests/bpf/progs/fexit_noreturns.c
Normal file
@@ -0,0 +1,15 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
#include <linux/bpf.h>
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include "bpf_misc.h"
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
||||
SEC("fexit/do_exit")
|
||||
__failure __msg("Attaching fexit/fmod_ret to __noreturn functions is rejected.")
|
||||
int BPF_PROG(noreturns)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user