Re: [PATCH bpf-next v7 3/3] selftests/bpf: add testcase for TRACING with 6+ arguments

From: Daniel Borkmann
Date: Mon Jun 26 2023 - 10:48:14 EST


On 6/22/23 9:57 AM, menglong8.dong@xxxxxxxxx wrote:
From: Menglong Dong <imagedong@xxxxxxxxxxx>

(CC'ing also Florent wrt arm64)

Add test9/test10 in fexit_test.c and fentry_test.c to test the fentry
and fexit whose target function have 7/11 arguments.

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:

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

./test_progs -t fentry
Summary: 3/0 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@xxxxxxxxxxx>
Acked-by: Yonghong Song <yhs@xxxxxx>
---
v6:
- add testcases to tracing_struct.c instead of fentry_test.c and
fexit_test.c
v5:
- add testcases for MODIFY_RETURN
v4:
- use different type for args in bpf_testmod_fentry_test{7,12}
- add testcase for grabage values in ctx
v3:
- move bpf_fentry_test{7,12} to bpf_testmod.c and rename them to
bpf_testmod_fentry_test{7,12} meanwhile
- get return value by bpf_get_func_ret() in
"fexit/bpf_testmod_fentry_test12", as we don't change ___bpf_ctx_cast()
in this version
---
net/bpf/test_run.c | 23 ++++++--
.../selftests/bpf/bpf_testmod/bpf_testmod.c | 49 ++++++++++++++++-
.../selftests/bpf/prog_tests/fentry_fexit.c | 4 +-
.../selftests/bpf/prog_tests/fentry_test.c | 2 +
.../selftests/bpf/prog_tests/fexit_test.c | 2 +
.../selftests/bpf/prog_tests/modify_return.c | 20 ++++++-
.../selftests/bpf/prog_tests/tracing_struct.c | 19 +++++++
.../testing/selftests/bpf/progs/fentry_test.c | 32 +++++++++++
.../testing/selftests/bpf/progs/fexit_test.c | 33 ++++++++++++
.../selftests/bpf/progs/modify_return.c | 40 ++++++++++++++
.../selftests/bpf/progs/tracing_struct.c | 54 +++++++++++++++++++
11 files changed, 271 insertions(+), 7 deletions(-)

This triggers test failures on arm64 in BPF CI given the additions are
not yet supported there:

https://github.com/kernel-patches/bpf/actions/runs/5371020820/jobs/9743606263
https://github.com/kernel-patches/bpf/actions/runs/5371020820/jobs/9743606326

[...]
Notice: Success: 362/3077, Skipped: 12, Failed: 3
Error: #71 fentry_fexit
Error: #71 fentry_fexit
test_fentry_fexit:PASS:fentry_skel_load 0 nsec
test_fentry_fexit:PASS:fexit_skel_load 0 nsec
test_fentry_fexit:FAIL:fentry_attach unexpected error: -1 (errno 524)
Error: #72 fentry_test
Error: #72 fentry_test
test_fentry_test:PASS:fentry_skel_load 0 nsec
fentry_test:FAIL:fentry_attach unexpected error: -1 (errno 524)
test_fentry_test:FAIL:fentry_first_attach unexpected error: -1 (errno 524)
Error: #76 fexit_test
Error: #76 fexit_test
test_fexit_test:PASS:fexit_skel_load 0 nsec
fexit_test:FAIL:fexit_attach unexpected error: -1 (errno 524)
test_fexit_test:FAIL:fexit_first_attach unexpected error: -1 (errno 524)
[...]

I think probably the best way would be to separate the new test cases and
then update tools/testing/selftests/bpf/DENYLIST.aarch64 to exclude them
from being run on arm64 until support gets added there too.

Thanks,
Daniel