lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 20 Aug 2020 14:24:19 -0700
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     Yonghong Song <yhs@...com>
Cc:     Mark Wielaard <mark@...mp.org>,
        Fāng-ruì Sòng <maskray@...gle.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Nick Clifton <nickc@...hat.com>,
        Jesper Dangaard Brouer <brouer@...hat.com>,
        Network Development <netdev@...r.kernel.org>,
        bpf <bpf@...r.kernel.org>, Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>,
        Andrii Nakryiko <andriin@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...omium.org>,
        clang-built-linux <clang-built-linux@...glegroups.com>
Subject: Re: [PATCH bpf-next] tools/resolve_btfids: Fix sections with wrong alignment

On Thu, Aug 20, 2020 at 10:54 AM Yonghong Song <yhs@...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!

Powered by blists - more mailing lists