Re: [PATCH v3 1/3] btf_encoder: skip functions consuming packed structs passed by value on stack

Alexis Lothoré
2025-08-04T07:13:49Z

Hi,

On Mon Jul 7, 2025 at 4:02 PM CEST, Alexis Lothoré (eBPF Foundation) wrote:
> Most ABIs allow functions to receive structs passed by value, if they
> fit in a register or a pair of registers, depending on the exact ABI.
> However, when there is a struct passed by value but all registers are
> already used for parameters passing, the struct is still passed by value
> but on the stack. This becomes an issue if the passed struct is defined
> with some attributes like __attribute__((packed)) or
> __attribute__((aligned(X)), as its location on the stack is altered, but
> this change is not reflected in dwarf information. The corresponding BTF
> data generated from this can lead to incorrect BPF trampolines
> generation (eg to attach bpf tracing programs to kernel functions) in
> the Linux kernel.
>
> Prevent those wrong cases by not encoding functions consuming structs
> passed by value on stack, when those structs do not have the expected
> alignment due to some attribute usage.
>
> Signed-off-by: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>

Gentle ping/follow-up on this series. Most of the discussions on this
revision were about an unrelated bug that has been submitted and merged in
[1], aside from that Alexei and Ihor provided some positive feedback on the
current revision. Any additional feedback on this ?

[1] https://lore.kernel.org/dwarves/20250731-lsk__abort-v3-1-40f79e168198@bootlin.com/

--
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering