Files
linux/tools/testing/selftests/bpf/progs/test_trampoline_count.c
T
Yuntao Wang b23316aabf selftests/bpf: Add missing trampoline program type to trampoline_count test
Currently the trampoline_count test doesn't include any fmod_ret bpf
programs, fix it to make the test cover all possible trampoline program
types.

Since fmod_ret bpf programs can't be attached to __set_task_comm function,
as it's neither whitelisted for error injection nor a security hook, change
it to bpf_modify_return_test.

This patch also does some other cleanups such as removing duplicate code,
dropping inconsistent comments, etc.

Signed-off-by: Yuntao Wang <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Acked-by: Yonghong Song <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
2022-05-20 16:12:14 -07:00

25 lines
460 B
C

// SPDX-License-Identifier: GPL-2.0
#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
SEC("fentry/bpf_modify_return_test")
int BPF_PROG(fentry_test, int a, int *b)
{
return 0;
}
SEC("fmod_ret/bpf_modify_return_test")
int BPF_PROG(fmod_ret_test, int a, int *b, int ret)
{
return 0;
}
SEC("fexit/bpf_modify_return_test")
int BPF_PROG(fexit_test, int a, int *b, int ret)
{
return 0;
}
char _license[] SEC("license") = "GPL";