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] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 23 Jan 2021 21:15:14 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Mark Wielaard <mark@...mp.org>
Cc:     Andrii Nakryiko <andrii.nakryiko@...il.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andriin@...com>, dwarves@...r.kernel.org,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        Yonghong Song <yhs@...com>, Hao Luo <haoluo@...gle.com>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...omium.org>,
        Joe Lawrence <joe.lawrence@...hat.com>
Subject: Re: [PATCH 2/3] bpf_encoder: Translate SHN_XINDEX in symbol's
 st_shndx values

On Sat, Jan 23, 2021 at 09:08:15PM +0100, Mark Wielaard wrote:
> Hi Jiri,
> 
> On Sat, 2021-01-23 at 19:51 +0100, Jiri Olsa wrote:
> > On Fri, Jan 22, 2021 at 02:55:51PM -0800, Andrii Nakryiko wrote:
> > > 
> > > > I don't understand this..  gelf_getsymshndx will return both
> > > > symbol and proper index, no? also sym_sec_idx is already
> > > > assigned from previou call
> > > 
> > > Reading (some) implementation of gelf_getsymshndx() that I found
> > > online, it won't set sym_sec_idx, if the symbol *doesn't* use
> > > extended
> > > numbering. But it will still return symbol data. So to return the
> > 
> > the latest upstream code seems to set it always,
> > but I agree we should be careful
> > 
> > Mark, any insight in here? thanks
> 
> GElf_Sym *
> gelf_getsymshndx (Elf_Data *symdata, Elf_Data *shndxdata, int ndx,
>                   GElf_Sym *dst, Elf32_Word *dstshndx)
> 
> Will always set *dst, but only set *dstshndx if both it and shndxdata
> are not NULL and no error occurred (the function returns NULL and set
> libelf_error in case of error).
> 
> So as long as shndxdata != NULL you can rely on *dstshndx being set.
> Otherwise you get the section index from dst->st_shndx.

ok, so it's as Andrii said, I'll make the extra check then

thanks,
jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ