From: sashiko-bot@kernel.org
To: "Dominique Martinet" <asmadeus@codewreck.org>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH 5.10-6.18] libbpf: fix cross-endian build with newer libbpf
Date: Mon, 16 Nov 2026 12:26:40 +0000 [thread overview]
Message-ID: <sashiko-outbox-217010@kernel.org> (raw)
In-Reply-To: <avryc0j9LwdUUGl7@codewreck.org>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] libbpf: missing Signed-off-by trailer and raw email reply as
commit log
- [Low] libbpf: missing Fixes trailer for btf_parse_hdr() endianness
check
--
commit bf42d3c49f2ac6667938fafec9c2e11053665406
Author: Dominique Martinet <asmadeus@codewreck.org>
> libbpf: fix cross-endian build with newer libbpf
>
> Alan Maguire wrote on Mon, Nov 16, 2026 at 08:51:24AM +0000:
> > > if (hdr->magic == bswap_16(BTF_MAGIC)) {
> > > btf->swapped_endian = true;
> > > - if (bswap_32(hdr->hdr_len) != sizeof(struct btf_header)) {
> > > + if (bswap_32(hdr->hdr_len) < sizeof(struct btf_header)) {
> >
> > Thanks for the fix! A small suggestion; what about matching the upstream test instead; i.e.
> >
> > if (bswap_32(hdr->hdr_len) < offsetofend(struct btf_header, str_len)) {
> >
> > That approach is a bit more portable as the str_len field was the last field in the
> > original BTF header, and it will work regardless of the size of struct btf_header.
>
> Thanks for the look!
>
> I wouldn't expect the struct to change in stable trees and favored a
> minimal patch; my opinion being that if someone does take the time to
> backport layout section handling or another btf_header extension in old
> trees then they can also fix the check properly...
>
> I actually prepared a v2 with this, but then noticed the raw_size check
> also ought to be updated if you want to handle struct btf_header changes:
[Severity: High]
The commit message is an unedited mailing-list reply that ends
mid-sentence rather than a standalone changelog description, and it is
missing a Signed-off-by trailer.
> diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
> index 231b07203e3d2..2dddee4870343 100644
> --- a/tools/lib/bpf/btf.c
> +++ b/tools/lib/bpf/btf.c
> @@ -191,14 +191,14 @@ static int btf_parse_hdr(struct btf *btf)
> struct btf_header *hdr = btf->hdr;
> __u32 meta_left;
>
> - if (btf->raw_size < sizeof(struct btf_header)) {
> + if (btf->raw_size < offsetofend(struct btf_header, str_len)) {
> pr_debug("BTF header not found\n");
> return -EINVAL;
> }
>
> if (hdr->magic == bswap_16(BTF_MAGIC)) {
> btf->swapped_endian = true;
> - if (bswap_32(hdr->hdr_len) != sizeof(struct btf_header)) {
> + if (bswap_32(hdr->hdr_len) < offsetofend(struct btf_header, str_len)) {
[Severity: Low]
This fixes the strict cross-endian header length check in btf_parse_hdr().
Should the commit message include:
Fixes: 3289959b97ca ("libbpf: Support BTF loading and raw data output in both endianness")
--
Sashiko AI review · https://sashiko.dev/#/patchset/avryc0j9LwdUUGl7@codewreck.org?part=1
prev parent reply other threads:[~2026-11-16 12:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-15 20:05 [PATCH 5.10-6.18] libbpf: fix cross-endian build with newer libbpf Dominique Martinet
2026-11-15 20:23 ` sashiko-bot
2026-11-15 20:41 ` Dominique Martinet
2026-11-16 8:51 ` Alan Maguire
2026-11-16 12:09 ` Dominique Martinet
2026-11-16 12:26 ` sashiko-bot [this message]
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=sashiko-outbox-217010@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=asmadeus@codewreck.org \
--cc=bpf@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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