On Tue, Aug 30, 2022 at 12:12:08AM +0200, Daniel Borkmann wrote: > On 8/28/22 4:55 AM, Yonghong Song wrote: > > Add various struct argument tests with fentry/fexit programs. > > Also add one test with a kernel func which does not have any > > argument to test BPF_PROG2 macro in such situation. > > > > Signed-off-by: Yonghong Song <yhs@xxxxxx> > > --- > > .../selftests/bpf/bpf_testmod/bpf_testmod.c | 48 ++++++++ > > .../selftests/bpf/prog_tests/tracing_struct.c | 63 ++++++++++ > > .../selftests/bpf/progs/tracing_struct.c | 114 ++++++++++++++++++ > > 3 files changed, 225 insertions(+) > > create mode 100644 tools/testing/selftests/bpf/prog_tests/tracing_struct.c > > create mode 100644 tools/testing/selftests/bpf/progs/tracing_struct.c > > > > For s390x these tests need to be deny-listed due to missing trampoline support.. > > All error logs: > test_fentry:PASS:tracing_struct__open_and_load 0 nsec > libbpf: prog 'test_struct_arg_1': failed to attach: ERROR: strerror_r(-524)=22 > libbpf: prog 'test_struct_arg_1': failed to auto-attach: -524 > test_fentry:FAIL:tracing_struct__attach unexpected error: -524 (errno 524) > #209 tracing_struct:FAIL > Summary: 189/972 PASSED, 27 SKIPPED, 1 FAILED > > However, looks like the no_alu32 ones on x86 fail: > > [...] > #207 trace_printk:OK > #208 trace_vprintk:OK > test_fentry:PASS:tracing_struct__open_and_load 0 nsec > test_fentry:PASS:tracing_struct__attach 0 nsec > trigger_module_test_read:PASS:testmod_file_open 0 nsec > test_fentry:PASS:trigger_read 0 nsec > test_fentry:PASS:t1:a.a 0 nsec > test_fentry:PASS:t1:a.b 0 nsec > test_fentry:PASS:t1:b 0 nsec > test_fentry:PASS:t1:c 0 nsec > test_fentry:PASS:t1 nregs 0 nsec > test_fentry:PASS:t1 reg0 0 nsec > test_fentry:PASS:t1 reg1 0 nsec > test_fentry:FAIL:t1 reg2 unexpected t1 reg2: actual 7327499336969879553 != expected 1 I'm getting the same, I think it's because the argument is int (4 bytes) while the register is 8, we need to cast to int before we check for the argument value jirka > test_fentry:PASS:t1 reg3 0 nsec > test_fentry:PASS:t1 ret 0 nsec > test_fentry:PASS:t2:a 0 nsec > test_fentry:PASS:t2:b.a 0 nsec > test_fentry:PASS:t2:b.b 0 nsec > test_fentry:PASS:t2:c 0 nsec > test_fentry:PASS:t2 ret 0 nsec > test_fentry:PASS:t3:a 0 nsec > test_fentry:PASS:t3:b 0 nsec > test_fentry:PASS:t3:c.a 0 nsec > test_fentry:PASS:t3:c.b 0 nsec > test_fentry:PASS:t3 ret 0 nsec > test_fentry:PASS:t4:a.a 0 nsec > test_fentry:PASS:t4:b 0 nsec > test_fentry:PASS:t4:c 0 nsec > test_fentry:PASS:t4:d 0 nsec > test_fentry:PASS:t4:e.a 0 nsec > test_fentry:PASS:t4:e.b 0 nsec > test_fentry:PASS:t4 ret 0 nsec > test_fentry:PASS:t5 ret 0 nsec > #209 tracing_struct:FAIL > #210 trampoline_count:OK > [...]