All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Yonghong Song <yhs@fb.com>, Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@google.com>, bpf <bpf@vger.kernel.org>
Subject: Re: [PATCH bpf-next v2] libbpf: ignore .eh_frame sections when parsing elf files
Date: Thu, 02 Sep 2021 19:08:03 +0200	[thread overview]
Message-ID: <87wnnysy6k.fsf@toke.dk> (raw)
In-Reply-To: <a65e20f9-d554-761e-9a9e-8a9dfcf13919@fb.com>

Yonghong Song <yhs@fb.com> writes:

> On 8/31/21 3:28 AM, Toke Høiland-Jørgensen wrote:
>> Andrii Nakryiko <andrii.nakryiko@gmail.com> writes:
>> 
>>> On Thu, Aug 26, 2021 at 5:10 AM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
>>>>
>>>> When .eh_frame and .rel.eh_frame sections are present in BPF object files,
>>>> libbpf produces errors like this when loading the file:
>>>>
>>>> libbpf: elf: skipping unrecognized data section(32) .eh_frame
>>>> libbpf: elf: skipping relo section(33) .rel.eh_frame for section(32) .eh_frame
>>>>
>>>> It is possible to get rid of the .eh_frame section by adding
>>>> -fno-asynchronous-unwind-tables to the compilation, but we have seen
>>>> multiple examples of these sections appearing in BPF files in the wild,
>>>> most recently in samples/bpf, fixed by:
>>>> 5a0ae9872d5c ("bpf, samples: Add -fno-asynchronous-unwind-tables to BPF Clang invocation")
>>>>
>>>> While the errors are technically harmless, they look odd and confuse users.
>>>
>>> These warnings point out invalid set of compiler flags used for
>>> compiling BPF object files, though. Which is a good thing and should
>>> incentivize anyone getting those warnings to check and fix how they do
>>> BPF compilation. Those .eh_frame sections shouldn't be present in BPF
>>> object files at all, and that's what libbpf is trying to say.
>> 
>> Apart from triggering that warning, what effect does this have, though?
>> The programs seem to work just fine (as evidenced by the fact that
>> samples/bpf has been built this way for years, for instance)...
>> 
>> Also, how is a user supposed to go from that cryptic error message to
>> figuring out that it has something to do with compiler flags?
>> 
>>> I don't know exactly in which situations that .eh_frame section is
>>> added, but looking at our selftests (and now samples/bpf as well),
>>> where we use -target bpf, we don't need
>>> -fno-asynchronous-unwind-tables at all.
>> 
>> This seems to at least be compiler-dependent. We ran into this with
>> bpftool as well (for the internal BPF programs it loads whenever it
>> runs), which already had '-target bpf' in the Makefile. We're carrying
>> an internal RHEL patch adding -fno-asynchronous-unwind-tables to the
>> bpftool build to fix this...
>
> I haven't seen an instance of .eh_frame as well with -target bpf.
> Do you have a reproducible test case? I would like to investigate
> what is the possible cause and whether we could do something in llvm
> to prevent its generatin. Thanks!

We found this in the RHEL builds of bpftool. I don't think we're doing
anything special, other than maybe building with a clang version that's
a few versions behind:

# clang --version
clang version 11.0.0 (Red Hat 11.0.0-1.module+el8.4.0+8598+a071fcd5)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

So I suppose it may resolve itself once we upgrade LLVM?

-Toke


  reply	other threads:[~2021-09-02 17:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-26 12:09 [PATCH bpf-next v2] libbpf: ignore .eh_frame sections when parsing elf files Toke Høiland-Jørgensen
2021-08-30 21:49 ` Andrii Nakryiko
2021-08-31 10:28   ` Toke Høiland-Jørgensen
2021-08-31 23:11     ` Andrii Nakryiko
2021-09-02  2:48     ` Yonghong Song
2021-09-02 17:08       ` Toke Høiland-Jørgensen [this message]
2021-09-02 19:32         ` Alexei Starovoitov
2021-09-02 21:54           ` Yonghong Song
2021-09-02 22:08             ` Toke Høiland-Jørgensen
2021-09-07 19:15               ` Yonghong Song
2021-09-07 19:36                 ` Toke Høiland-Jørgensen
2021-09-07 22:24                   ` Yonghong Song

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=87wnnysy6k.fsf@toke.dk \
    --to=toke@redhat.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=sdf@google.com \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.