[PATCH RFC bpf-next 3/4] bpf/selftests: add tests to validate proper arguments alignment on ARM64
Eduard Zingerman
eddyz87 at gmail.com
Mon Apr 28 00:01:05 PDT 2025
On Fri, 2025-04-11 at 22:32 +0200, Alexis Lothoré (eBPF Foundation) wrote:
> When dealing with large types (>8 bytes), ARM64 trampolines need to take
> extra care about the arguments alignment to respect the calling
> convention set by AAPCS64.
>
> Add two tests ensuring that the BPF trampoline arranges arguments with
> the relevant layout. The two new tests involve almost the same
> arguments, except that the second one requires a more specific alignment
> to be set by the trampoline when preparing arguments before calling the
> the target function.
>
> Signed-off-by: Alexis Lothoré (eBPF Foundation) <alexis.lothore at bootlin.com>
> ---
[...]
> +SEC("fentry/bpf_testmod_test_struct_arg_11")
> +int BPF_PROG2(test_struct_many_args_9, struct bpf_testmod_struct_arg_5, a,
> + struct bpf_testmod_struct_arg_5, b,
> + struct bpf_testmod_struct_arg_5, c,
> + struct bpf_testmod_struct_arg_5, d, int, e,
> + struct bpf_testmod_struct_arg_5, f)
Hello Alexis,
I'm trying to double check the error you've seen for x86.
I see that tracing_struct/struct_many_args fails with assertion:
"test_struct_many_args:FAIL:t11:f unexpected t11:f: actual 35 != expected 43".
Could you please help me understand this test?
The function listened to is defined as accepting 'struct bpf_testmod_struct_arg_7',
at the same time this function uses 'struct bpf_testmod_struct_arg_5'.
Nevertheless, the assertion persists even with correct types.
> +{
> + t11_a = a.a;
> + t11_b = b.a;
> + t11_c = c.a;
> + t11_d = d.a;
> + t11_e = e;
> + t11_f = f.a;
> + return 0;
> +}
[...]
More information about the linux-arm-kernel
mailing list