On Fri, Aug 30, 2024 at 4:26 AM Alan Maguire <alan.maguire@xxxxxxxxxx> wrote: > > On 30/08/2024 12:15, Eduard Zingerman wrote: > > On Fri, 2024-08-30 at 02:51 -0700, Tony Ambardar wrote: > >> The pahole master branch recently added support for "distilled BTF" based > >> on libbpf v1.5, but may add .BTF and .BTF.base sections with the wrong byte > >> order (e.g. on s390x BPF CI), which then lead to kernel Oops when loaded. > >> > >> Fix by updating libbpf's btf__distill_base() and btf_new_empty() to retain > >> the byte order of any source BTF objects when creating new ones. > >> > >> Reported-by: Song Liu <song@xxxxxxxxxx> > >> Reported-by: Eduard Zingerman <eddyz87@xxxxxxxxx> > >> Suggested-by: Eduard Zingerman <eddyz87@xxxxxxxxx> > >> Link: https://lore.kernel.org/bpf/6358db36c5f68b07873a0a5be2d062b1af5ea5f8.camel@xxxxxxxxx/ > >> Signed-off-by: Tony Ambardar <tony.ambardar@xxxxxxxxx> > >> --- > > > > Acked-by: Eduard Zingerman <eddyz87@xxxxxxxxx> > > > > Tested-by: Alan Maguire <alan.maguire@xxxxxxxxxx> > > Thanks for the fix! > > > But we also need a test for this. Like the one attached. > > Or Alan can share his test, which is much shorter but skips round trip to bytes and back. > > > > Eduard's test is better than mine; mine was a simple addition to > btf_endian() tests that checked split/distilled BTF matched endianness > of the originating BTF for non-native endianness. Having actual > non-native endianness _use_ as in Eduard's test is much preferred I think. Eduard, please send it as a proper patch? > > > [...]