Re: [PATCH 18/19] selftests/bpf: Add fentry/fexit multi func test

Jiri Olsa
2021-06-09T14:29:53Z

On Tue, Jun 08, 2021 at 10:41:37PM -0700, Andrii Nakryiko wrote:
> On Sat, Jun 5, 2021 at 4:13 AM Jiri Olsa <jolsa@kernel.org> wrote:
> >
> > Adding selftest for fentry/fexit multi func test that attaches
> > to bpf_fentry_test* functions and checks argument values based
> > on the processed function.
> >
> > When multi_arg_check is used from 2 different places I'm getting
> > compilation fail, which I did not deciphered yet:
> >
> > $ CLANG=/opt/clang/bin/clang LLC=/opt/clang/bin/llc make
> > CLNG-BPF [test_maps] fentry_fexit_multi_test.o
> > progs/fentry_fexit_multi_test.c:18:2: error: too many args to t24: i64 = \
> > GlobalAddress<void (i64, i64, i64, i64, i64, i64, i64, i64*)* @multi_arg_check> 0, \
> > progs/fentry_fexit_multi_test.c:18:2 @[ progs/fentry_fexit_multi_test.c:16:5 ]
> > multi_arg_check(ip, a, b, c, d, e, f, &test1_arg_result);
> > ^
> > progs/fentry_fexit_multi_test.c:25:2: error: too many args to t32: i64 = \
> > GlobalAddress<void (i64, i64, i64, i64, i64, i64, i64, i64*)* @multi_arg_check> 0, \
> > progs/fentry_fexit_multi_test.c:25:2 @[ progs/fentry_fexit_multi_test.c:23:5 ]
> > multi_arg_check(ip, a, b, c, d, e, f, &test2_arg_result);
> > ^
> > In file included from progs/fentry_fexit_multi_test.c:5:
> > /home/jolsa/linux-qemu/tools/testing/selftests/bpf/multi_check.h:9:6: error: defined with too many args
> > void multi_arg_check(unsigned long ip, __u64 a, __u64 b, __u64 c, __u64 d, __u64 e, __u64 f, __u64 *test_result)
> > ^
> > /home/jolsa/linux-qemu/tools/testing/selftests/bpf/multi_check.h:9:6: error: defined with too many args
> > /home/jolsa/linux-qemu/tools/testing/selftests/bpf/multi_check.h:9:6: error: defined with too many args
> > 5 errors generated.
> > make: *** [Makefile:470: /home/jolsa/linux-qemu/tools/testing/selftests/bpf/fentry_fexit_multi_test.o] Error 1
> >
> > I can fix that by defining 2 separate multi_arg_check functions
> > with different names, which I did in follow up temporaary patch.
> > Not sure I'm hitting some clang/bpf limitation in here?
>
> don't know about clang limitations, but we should use static linking
> proper anyways

ok, will change

thanks,
jirka