Re: Segfault in pahole 1.18 when building kernel 5.9.1 for arm64

From: Jiri Slaby
Date: Wed Oct 21 2020 - 01:52:34 EST


On 20. 10. 20, 19:15, Andrii Nakryiko wrote:
On Tue, Oct 20, 2020 at 3:51 AM Jiri Slaby <jirislaby@xxxxxxxxxx> wrote:

Hi,

On 19. 10. 20, 1:18, Érico Rolim wrote:
I'm trying to build kernel 5.9.1 for arm64, and my dotconfig has
`CONFIG_DEBUG_INFO_BTF=y`, which requires pahole for building. However, pahole
version 1.18 segfaults during the build, as can be seen below:

PAHOLE: Error: Found symbol of zero size when encoding btf (sym:
'__kvm_nvhe_arm64_ssbd_callback_required', cu:
'arch/arm64/kernel/cpu_errata.c').

The symbol is an alias coming from arch/arm64/kernel/vmlinux.lds:
__kvm_nvhe_arm64_ssbd_callback_required = arm64_ssbd_callback_required;;

What's readelf's output for that symbol? If it's legal for SST_OBJECT
to have size zero, then we should just skip those in pahole. But it
shouldn't crash in either case, of course. But as Arnaldo mentioned,
that code changed significantly recently, so please check with latest
pahole from tmp.libbtf_encoder branch.
...
Yeah, I observe the very same. I reported it at:
https://bugzilla.suse.com/show_bug.cgi?id=1177921

If you looked here, you would see:
> $ readelf -Ws vml |grep arm64_ssbd_callback_re
> 154271: ffff80001133e000 0 OBJECT GLOBAL DEFAULT 22 __kvm_nvhe_arm64_ssbd_callback_required
> 159609: ffff80001133e000 8 OBJECT WEAK DEFAULT 22 arm64_ssbd_callback_required

Yes, its zero-sized. And yes, the error happens even with tmp.libbtf_encoder, but pahole doesn't crash and the build finishes fine.

thanks,
--
js