BPF List
 help / color / mirror / Atom feed
From: Dominique Martinet <asmadeus@codewreck.org>
To: Greg KH <greg@kroah.com>
Cc: stable@vger.kernel.org, Alan Maguire <alan.maguire@oracle.com>,
	andrii@kernel.org, eddyz87@gmail.com, ast@kernel.org,
	ihor.solodrai@linux.dev, daniel@iogearbox.net, memxor@gmail.com,
	martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev,
	jolsa@kernel.org, emil@etsalapatis.com, dwarves@vger.kernel.org,
	bpf@vger.kernel.org, Alan Maguire <almagui@kernel.org>
Subject: Re: [PATCH 5.10-6.18 v2] libbpf: fix cross-endian build with newer libbpf
Date: Mon, 23 Nov 2026 18:17:08 +0900	[thread overview]
Message-ID: <awQElOwB_C7UzMXF@codewreck.org> (raw)
In-Reply-To: <2026112357-corncob-exclude-7266@gregkh>

Greg KH wrote on Mon, Nov 23, 2026 at 08:01:33AM +0100:
> On Tue, Nov 17, 2026 at 08:33:01AM +0900, Dominique Martinet wrote:
> > commit 087f3964f4b3 ("libbpf: Support layout section handling in BTF")
> > added extra data to the BTF header.
> > 
> > This extra data is ignored in the native case, but when building with
> > different endianness the bswap code in old libbpf would check for strict
> > size equality, leading to build failures such as this when BTF data is
> > generated with a newer version of libbpf (through pahole)
> >     BTFIDS  vmlinux.unstripped
> >   libbpf: Can't load BTF with non-native endianness due to unsupported header length 32
> >   FAILED: load BTF from vmlinux.unstripped: Operation not supported
> >   make[2]: *** [../scripts/Makefile.vmlinux:72: vmlinux.unstripped] Error 255
> > 
> > Newer libbpf versions also properly ignore trailing data in the bswap
> > case, but the patch is too intrusive to backport, so take the header 
> > length comparison fix from it instead.
> 
> Why not always just use the libbpf version from newer kernels?

I'm a simple user as far as this part of the tree goes, but the build
system uses two libbpf versions:
- indirectly, whatever was used to build pahole to generate BTF
debuginfos
- directly, what is in the build tree to generate BTFIDs from the above
BTF debuginfos (tools/bpf/resolve_btfids)

This build failure happens if pahole uses a newer libbpf version, that
the libbpf version in the kernel isn't able to parse because of a too
strict check in the cross-endian case.

Technically resolve_btfids could probably be built with the system
libbpf instead of the one in the kernel tree but then we'd need to
backport potential build failures instead if the libbpf API changes, I'm
not sure it'd be less work in the long run.


> And why not backport the full series, one-off are almost always more
> work over time.

Happy to send a revert of the above patch + full series backport if
that's what you/libbpf maintainers prefer...
In this case the current code already supports newer libbpf versions and
the bug was only in a corner case with cross-endian handling (e.g. I'm
not expecting further fixes to be needed in that area), so it seemed
simpler to just backport that part of the patch instead of backporting a
"feature patch", but I'm not fussy.

I'd argue that the cross-endian fix should have been a separate commit
instead of being part of a new feature commit in the first place, but
hindsight 20/20 and it probably wasn't obvious that it'd cause build
failures at the time...

Anyway, I stand by my opinion that minimal patch sounds better to me,
but just say the word and I can look at backporting the full layout
section handling code instead. Not sure I'd be able to get prereqs right
for very old kernels but 5.10/5.15 are gone next month anyway...

Thanks,
-- 
Dominique

      reply	other threads:[~2026-11-23  9:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 23:33 [PATCH 5.10-6.18 v2] libbpf: fix cross-endian build with newer libbpf Dominique Martinet
2026-11-17  8:19 ` Greg KH
2026-11-18  0:19 ` Sasha Levin
2026-11-18  0:22   ` Sasha Levin
2026-11-23  7:01 ` Greg KH
2026-11-23  9:17   ` Dominique Martinet [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=awQElOwB_C7UzMXF@codewreck.org \
    --to=asmadeus@codewreck.org \
    --cc=alan.maguire@oracle.com \
    --cc=almagui@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=dwarves@vger.kernel.org \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=greg@kroah.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=jolsa@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=song@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=yonghong.song@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