1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/tools/testing/selftests/bpf/progs/fexit_many_args.c
Menglong Dong 5e9cf77d81 selftests/bpf: add testcase for TRACING with 6+ arguments
Add fentry_many_args.c and fexit_many_args.c to test the fentry/fexit
with 7/11 arguments. As this feature is not supported by arm64 yet, we
disable these testcases for arm64 in DENYLIST.aarch64. We can combine
them with fentry_test.c/fexit_test.c when arm64 is supported too.

Correspondingly, add bpf_testmod_fentry_test7() and
bpf_testmod_fentry_test11() to bpf_testmod.c

Meanwhile, add bpf_modify_return_test2() to test_run.c to test the
MODIFY_RETURN with 7 arguments.

Add bpf_testmod_test_struct_arg_7/bpf_testmod_test_struct_arg_7 in
bpf_testmod.c to test the struct in the arguments.

And the testcases passed on x86_64:

./test_progs -t fexit
Summary: 5/14 PASSED, 0 SKIPPED, 0 FAILED

./test_progs -t fentry
Summary: 3/2 PASSED, 0 SKIPPED, 0 FAILED

./test_progs -t modify_return
Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED

./test_progs -t tracing_struct
Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED

Signed-off-by: Menglong Dong <imagedong@tencent.com>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/r/20230713040738.1789742-4-imagedong@tencent.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2023-07-13 16:04:56 -07:00

40 lines
1.2 KiB
C

// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2023 Tencent */
#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
char _license[] SEC("license") = "GPL";
__u64 test1_result = 0;
SEC("fexit/bpf_testmod_fentry_test7")
int BPF_PROG(test1, __u64 a, void *b, short c, int d, void *e, char f,
int g, int ret)
{
test1_result = a == 16 && b == (void *)17 && c == 18 && d == 19 &&
e == (void *)20 && f == 21 && g == 22 && ret == 133;
return 0;
}
__u64 test2_result = 0;
SEC("fexit/bpf_testmod_fentry_test11")
int BPF_PROG(test2, __u64 a, void *b, short c, int d, void *e, char f,
int g, unsigned int h, long i, __u64 j, unsigned long k,
int ret)
{
test2_result = a == 16 && b == (void *)17 && c == 18 && d == 19 &&
e == (void *)20 && f == 21 && g == 22 && h == 23 &&
i == 24 && j == 25 && k == 26 && ret == 231;
return 0;
}
__u64 test3_result = 0;
SEC("fexit/bpf_testmod_fentry_test11")
int BPF_PROG(test3, __u64 a, __u64 b, __u64 c, __u64 d, __u64 e, __u64 f,
__u64 g, __u64 h, __u64 i, __u64 j, __u64 k, __u64 ret)
{
test3_result = a == 16 && b == 17 && c == 18 && d == 19 &&
e == 20 && f == 21 && g == 22 && h == 23 &&
i == 24 && j == 25 && k == 26 && ret == 231;
return 0;
}