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  linux-cve-announce  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: Mon, 24 Jun 2024 20:28:22 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Jiri Olsa <olsajiri@...il.com>
Cc: Alexey Dobriyan <adobriyan@...il.com>, Andrew Morton <akpm@...ux-foundation.org>, 
	linux-kernel@...r.kernel.org, bpf@...r.kernel.org
Subject: Re: [PATCH v2] build-id: require program headers to be right after
 ELF header

On Mon, Jun 24, 2024 at 4:23 AM Jiri Olsa <olsajiri@...il.com> wrote:
>
> ccing bpf list
>
> On Fri, Jun 21, 2024 at 09:39:33PM +0300, Alexey Dobriyan wrote:
> > Neither ELF spec not ELF loader require program header to be placed
> > right after ELF header, but build-id code very much assumes such placement:
> >
> > See
> >
> >       find_get_page(vma->vm_file->f_mapping, 0);
> >
> > line and checks against PAGE_SIZE.
> >
> > Returns errors for now until someone rewrites build-id parser
> > to be more inline with load_elf_binary().
> >
> > Signed-off-by: Alexey Dobriyan <adobriyan@...il.com>
> > ---
> >
> >  lib/buildid.c |   14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> >

LGTM, but let's please route this through the bpf-next/master tree.
Can you please send it to bpf@...r.kernel.org?

Acked-by: Andrii Nakryiko <andrii@...nel.org>

> > --- a/lib/buildid.c
> > +++ b/lib/buildid.c
> > @@ -73,6 +73,13 @@ static int get_build_id_32(const void *page_addr, unsigned char *build_id,
> >       Elf32_Phdr *phdr;
> >       int i;
> >
> > +     /*
> > +      * FIXME
>
> nit, FIXME is usually on the same line as the rest of the comment,
> otherwise looks good
>
> Reviewed-by: Jiri Olsa <jolsa@...nel.org>
>
> thanks,
> jirka
>
>
> > +      * Neither ELF spec nor ELF loader require that program headers
> > +      * start immediately after ELF header.
> > +      */
> > +     if (ehdr->e_phoff != sizeof(Elf32_Ehdr))
> > +             return -EINVAL;
> >       /* only supports phdr that fits in one page */
> >       if (ehdr->e_phnum >
> >           (PAGE_SIZE - sizeof(Elf32_Ehdr)) / sizeof(Elf32_Phdr))
> > @@ -98,6 +105,13 @@ static int get_build_id_64(const void *page_addr, unsigned char *build_id,
> >       Elf64_Phdr *phdr;
> >       int i;
> >
> > +     /*
> > +      * FIXME
> > +      * Neither ELF spec nor ELF loader require that program headers
> > +      * start immediately after ELF header.
> > +      */
> > +     if (ehdr->e_phoff != sizeof(Elf64_Ehdr))
> > +             return -EINVAL;
> >       /* only supports phdr that fits in one page */
> >       if (ehdr->e_phnum >
> >           (PAGE_SIZE - sizeof(Elf64_Ehdr)) / sizeof(Elf64_Phdr))
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ