Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Yonghong Song <yhs@fb.com>
Cc: "Mark Wielaard" <mark@klomp.org>,
	"Fāng-ruì Sòng" <maskray@google.com>,
	"Jiri Olsa" <jolsa@kernel.org>,
	"Nick Desaulniers" <ndesaulniers@google.com>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Nick Clifton" <nickc@redhat.com>,
	"Jesper Dangaard Brouer" <brouer@redhat.com>,
	"Network Development" <netdev@vger.kernel.org>,
	bpf <bpf@vger.kernel.org>, "Martin KaFai Lau" <kafai@fb.com>,
	"Song Liu" <songliubraving@fb.com>,
	"Andrii Nakryiko" <andriin@fb.com>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"KP Singh" <kpsingh@chromium.org>,
	clang-built-linux <clang-built-linux@googlegroups.com>
Subject: Re: [PATCH bpf-next] tools/resolve_btfids: Fix sections with wrong alignment
Date: Thu, 20 Aug 2020 14:24:19 -0700	[thread overview]
Message-ID: <CAADnVQ+C3OMe=5=j-zqcTNA=Yo1NtGRkzpwNzUrDfGsQnMagZQ@mail.gmail.com> (raw)
In-Reply-To: <35b05eda-f76a-a071-d69e-9ba8c6f48382@fb.com>

On Thu, Aug 20, 2020 at 10:54 AM Yonghong Song <yhs@fb.com> wrote:
>
>
>
> On 8/20/20 10:36 AM, Mark Wielaard wrote:
> > Hi
> >
> > On Thu, 2020-08-20 at 08:51 -0700, Yonghong Song wrote:
> >>>> Do you think we could skip these .debug_* sections somehow in elf
> >>>> parsing in resolve_btfids? resolve_btfids does not need to read
> >>>> these sections. This way, no need to change their alignment
> >>>> either.
> >>>
> >>> The issue is that elfutils libelf will not allow writing out the
> >>> section when it notices the sh_addralign field is setup wrongly.
> >>
> >> Maybe resolve_btfids can temporarily change sh_addralign to 4/8
> >> before elf manipulation (elf_write) to make libelf happy.
> >> After all elf_write is done, change back to whatever the
> >> original value (1). Does this work?
> >
> > Unfortunately no, because there is no elf_write, elf_update is how you
> > write out the ELF image to disc.
> >
> > Since the code is using ELF_F_LAYOUT this will not change the actual
> > layout of the ELF image if that is what you are worried about.
> >
> > And the workaround to set sh_addralign correctly before calling
> > elf_update is precisely what the fix in elfutils libelf will do itself
> > in the next release. Also binutils ld has been fixed to setup
> > sh_addralign to 4/8 as appropriate now (in git).
>
> Sounds good then.
> Thanks for fixing the issue in upstream, both libelf and binutils!

In the meantime I've applied Jiri's workaround to bpf tree. Thanks!

  reply	other threads:[~2020-08-20 21:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-19  9:23 Jiri Olsa
2020-08-19 15:31 ` Yonghong Song
2020-08-19 17:36   ` Jiri Olsa
2020-08-19 18:16     ` Nick Desaulniers
2020-08-19 21:30       ` Yonghong Song
2020-08-20  2:27         ` Fāng-ruì Sòng
2020-08-20  3:23           ` Yonghong Song
2020-08-20 10:18             ` Jiri Olsa
2020-08-20 10:18             ` Mark Wielaard
2020-08-20 15:51               ` Yonghong Song
2020-08-20 17:36                 ` Mark Wielaard
2020-08-20 17:54                   ` Yonghong Song
2020-08-20 21:24                     ` Alexei Starovoitov [this message]
2020-08-19 17:02 ` Jesper Dangaard Brouer
2020-08-19 21:32 ` 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='CAADnVQ+C3OMe=5=j-zqcTNA=Yo1NtGRkzpwNzUrDfGsQnMagZQ@mail.gmail.com' \
    --to=alexei.starovoitov@gmail.com \
    --cc=andriin@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brouer@redhat.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kafai@fb.com \
    --cc=kpsingh@chromium.org \
    --cc=mark@klomp.org \
    --cc=maskray@google.com \
    --cc=ndesaulniers@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=nickc@redhat.com \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    --subject='Re: [PATCH bpf-next] tools/resolve_btfids: Fix sections with wrong alignment' \
    /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

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).