From: "Alexis Lothoré" <alexis.lothore@bootlin.com>
To: "Alexis Lothoré (eBPF Foundation)" <alexis.lothore@bootlin.com>,
dwarves@vger.kernel.org
Cc: <bpf@vger.kernel.org>, "Alan Maguire" <alan.maguire@oracle.com>,
"Arnaldo Carvalho de Melo" <acme@kernel.org>,
"Alexei Starovoitov" <ast@fb.com>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
"Bastien Curutchet" <bastien.curutchet@bootlin.com>,
<ebpf@linuxfoundation.org>
Subject: Re: [PATCH v3 1/3] btf_encoder: skip functions consuming packed structs passed by value on stack
Date: Mon, 04 Aug 2025 09:13:40 +0200 [thread overview]
Message-ID: <DBTGH8VGCJM5.160FSRY06LNUC@bootlin.com> (raw)
In-Reply-To: <20250707-btf_skip_structs_on_stack-v3-1-29569e086c12@bootlin.com>
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
https://bootlin.com
next prev parent reply other threads:[~2025-08-04 7:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-07 14:02 [PATCH v3 0/3] btf_encoder: do not encode functions consuming packed structs on stack Alexis Lothoré (eBPF Foundation)
2025-07-07 14:02 ` [PATCH v3 1/3] btf_encoder: skip functions consuming packed structs passed by value " Alexis Lothoré (eBPF Foundation)
2025-07-07 17:05 ` Alexei Starovoitov
2025-07-07 17:45 ` Ihor Solodrai
2025-08-04 7:13 ` Alexis Lothoré [this message]
2025-08-04 9:58 ` Jiri Olsa
2025-07-07 14:02 ` [PATCH v3 2/3] tests: add some tests validating skipped functions due to uncertain arg location Alexis Lothoré (eBPF Foundation)
2025-07-07 14:14 ` Alexis Lothoré
2025-07-07 19:36 ` Ihor Solodrai
2025-07-09 16:21 ` Alan Maguire
2025-07-15 8:04 ` Alexis Lothoré
2025-07-15 15:36 ` Ihor Solodrai
2025-08-05 15:09 ` Alan Maguire
2025-08-05 19:06 ` Alexis Lothoré
2025-08-06 11:14 ` Alan Maguire
2025-07-07 14:02 ` [PATCH v3 3/3] gitignore: ignore all the test kmod build-related files Alexis Lothoré (eBPF Foundation)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DBTGH8VGCJM5.160FSRY06LNUC@bootlin.com \
--to=alexis.lothore@bootlin.com \
--cc=acme@kernel.org \
--cc=alan.maguire@oracle.com \
--cc=ast@fb.com \
--cc=bastien.curutchet@bootlin.com \
--cc=bpf@vger.kernel.org \
--cc=dwarves@vger.kernel.org \
--cc=ebpf@linuxfoundation.org \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).