linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hao Luo <haoluo@google.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: "Arnaldo Carvalho de Melo" <acme@kernel.org>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	"Érico Rolim" <erico.erc@gmail.com>,
	dwarves@vger.kernel.org,
	"open list" <linux-kernel@vger.kernel.org>,
	"Arnaldo Carvalho de Melo" <acme@redhat.com>,
	"Andrii Nakryiko" <andriin@fb.com>,
	"Alexei Starovoitov" <alexei.starovoitov@gmail.com>,
	bpf <bpf@vger.kernel.org>
Subject: Re: Segfault in pahole 1.18 when building kernel 5.9.1 for arm64
Date: Tue, 20 Oct 2020 10:18:45 -0700	[thread overview]
Message-ID: <CA+khW7hcXG5d=WxxHK-D8ubEnTtM+oic7cs61j_DZfze0K-VPg@mail.gmail.com> (raw)
In-Reply-To: <CAEf4BzYDvvthK_S7EecsTO3HAVXiAf6AqHaiEWbf9+K7sjMiLA@mail.gmail.com>

On Tue, Oct 20, 2020 at 10:10 AM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Tue, Oct 20, 2020 at 10:05 AM Hao Luo <haoluo@google.com> wrote:
> >
> > Thanks for reporting this and cc'ing me. I forgot to update the error
> > messages when renaming the flags. I will send a patch to fix the error
> > message.
> >
> > The commit
> >
> > commit f3d9054ba8ff1df0fc44e507e3a01c0964cabd42
> > Author:     Hao Luo <haoluo@google.com>
> > AuthorDate: Wed Jul 8 13:44:10 2020 -0700
> >
> >      btf_encoder: Teach pahole to store percpu variables in vmlinux BTF.
> >
> > encodes kernel global variables into BTF so that bpf programs can
> > directly access them. If there is no need to access kernel global
> > variables, it's perfectly fine to use '--btf_encode_force' to skip
> > encoding bad symbols into BTF, or '--skip_encoding_btf_vars' to skip
> > encoding all global vars all together. I will add these info into the
> > updated error message.
> >
> > Also cc bpf folks for attention of this bug.
>
> I've already fixed the message as part of
> 2e719cca6672 ("btf_encoder: revamp how per-CPU variables are encoded")
>

Ah, that's awesome! Thanks for fixing this, Andrii. I haven't got time
to take a look at your patches last week, I will try to look at it
ASAP.

> It's currently still in the tmp.libbtf_encoder branch in pahole repo.
>
> >
> > Hao
> >
> > On Tue, Oct 20, 2020 at 5:20 AM Arnaldo Carvalho de Melo
> > <acme@kernel.org> wrote:
> > >
> > > Em Tue, Oct 20, 2020 at 11:01:39AM +0200, Jiri Slaby escreveu:
> > > > 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;;
> > > >
> > > > > PAHOLE: Error: Use '-j' or '--force' to ignore such symbols and force
> > > > > emit the btf.
> > > > > scripts/link-vmlinux.sh: line 141: 43837 Segmentation fault
> > > > > LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1}
> > > > >    LD      .tmp_vmlinux.kallsyms1
> > > > >    KSYM    .tmp_vmlinux.kallsyms1.o
> > > > >    LD      .tmp_vmlinux.kallsyms2
> > > > >    KSYM    .tmp_vmlinux.kallsyms2.o
> > > > >    LD      vmlinux
> > > > >    BTFIDS  vmlinux
> > > > > FAILED: load BTF from vmlinux: Unknown error -2make: ***
> > > > > [Makefile:1162: vmlinux] Error 255
> > > > >
> > > > > It is possible to force the build to continue if
> > > > >
> > > > >    LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1}
> > > > >
> > > > > in scripts/link-vmlinux.sh is changed to
> > > > >
> > > > >    LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J --btf_encode_force ${1}
> > > > >
> > > > > The suggested `-j` or `--force` flags don't exist, since they were removed in
> > > > > [1]. I believe `--btf_encode_force` should be suggested instead.
> > > >
> > > > Agreed, '--btf_encode_force' makes pahole to proceed without crashes.
> > > >
> > > > > It should be noted that the same build, but with pahole version 1.17, works
> > > > > without issue, so I think this is either a regression in pahole or the script
> > > > > will need to be changed for newer versions of pahole.
> > > >
> > > > Yeah, I observe the very same. I reported it at:
> > > > https://bugzilla.suse.com/show_bug.cgi?id=1177921
> > >
> > > Would it be possible to try with
> > > https://git.kernel.org/pub/scm/devel/pahole/pahole.git/commit/?h=tmp.libbtf_encoder
> > > ?
> > >
> > > This switches to using libbpf for the BTF encoder and may have fixed
> > > this problem.
> > >
> > > - Arnaldo
> > >
>
> [...]
>
> > > >
> > > >
> > > > I suspect:
> > > > commit f3d9054ba8ff1df0fc44e507e3a01c0964cabd42
> > > > Author:     Hao Luo <haoluo@google.com>
> > > > AuthorDate: Wed Jul 8 13:44:10 2020 -0700
> > > >
> > > >     btf_encoder: Teach pahole to store percpu variables in vmlinux BTF.
> > > >
> > > >
> > > > Which added this machinery (btf_elf__add_datasec_type in particular).
> > > >
> > > > > - [1] https://git.kernel.org/pub/scm/devel/pahole/pahole.git/commit/pahole.c?h=v1.18&id=1abc001417b579b86a9b27ff88c9095d8f498a46
> > > > >
> > > > > Thanks,
> > > > > Érico
> > > > >
> > > >
> > > >
> > > > --
> > > > js
> > > > suse labs
> > >
> > > --
> > >
> > > - Arnaldo

  reply	other threads:[~2020-10-20 17:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-18 23:18 Segfault in pahole 1.18 when building kernel 5.9.1 for arm64 Érico Rolim
2020-10-20  9:01 ` Jiri Slaby
2020-10-20 12:20   ` Arnaldo Carvalho de Melo
2020-10-20 17:04     ` Hao Luo
2020-10-20 17:10       ` Andrii Nakryiko
2020-10-20 17:18         ` Hao Luo [this message]
2020-10-20 18:14         ` Arnaldo Carvalho de Melo
2020-10-20 19:02           ` Arnaldo Carvalho de Melo
2020-10-21  6:22     ` Jiri Slaby
2020-10-21 11:29       ` Arnaldo Carvalho de Melo
2020-10-21 15:53         ` Andrii Nakryiko
2020-10-21 16:26           ` Arnaldo Carvalho de Melo
2020-10-20 17:15   ` Andrii Nakryiko
2020-10-21  5:52     ` Jiri Slaby

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='CA+khW7hcXG5d=WxxHK-D8ubEnTtM+oic7cs61j_DZfze0K-VPg@mail.gmail.com' \
    --to=haoluo@google.com \
    --cc=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andriin@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=dwarves@vger.kernel.org \
    --cc=erico.erc@gmail.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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).