[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABCJKueyGPNeUqW_xWdG11OxHDWsMM0CtV31sbg4LL0FggEN=g@mail.gmail.com>
Date: Tue, 1 Oct 2024 20:06:59 +0000
From: Sami Tolvanen <samitolvanen@...gle.com>
To: Petr Pavlu <petr.pavlu@...e.com>
Cc: Masahiro Yamada <masahiroy@...nel.org>, Luis Chamberlain <mcgrof@...nel.org>,
Miguel Ojeda <ojeda@...nel.org>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Matthew Maurer <mmaurer@...gle.com>, Alex Gaynor <alex.gaynor@...il.com>,
Wedson Almeida Filho <wedsonaf@...il.com>, Gary Guo <gary@...yguo.net>, Neal Gompa <neal@...pa.dev>,
Hector Martin <marcan@...can.st>, Janne Grunau <j@...nau.net>, Miroslav Benes <mbenes@...e.cz>,
Asahi Linux <asahi@...ts.linux.dev>, linux-kbuild@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-modules@...r.kernel.org,
rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v3 04/20] gendwarfksyms: Add address matching
On Tue, Oct 1, 2024 at 2:06 PM Petr Pavlu <petr.pavlu@...e.com> wrote:
>
> On 9/23/24 20:18, Sami Tolvanen wrote:
> > - for_each(name, get_symbol, &sym);
> > + for_each(name, false, get_symbol, &sym);
> > return sym;
> > }
>
> What is the reason that the for_each() call in symbol_get() is invoked
> with name_only=false?
It was initially added to skip address checking when reading the
symbol list, but it's redundant since there are no addresses to check
at that point anyway. I think we can just drop the name_only argument
completely. I'll change this in v4.
> > + for (n = 1; n < nsyms; ++n) {
> > + const char *name = NULL;
> > + Elf32_Word xndx = 0;
> > + GElf_Sym sym_mem;
> > + GElf_Sym *sym;
> > +
> > + sym = gelf_getsymshndx(data, xndx_data, n,
> > + &sym_mem, &xndx);
>
> Please check for sym==NULL in case the file is malformed, e.g.
> .symtab_shndx is truncated.
Good catch, I'll add a check.
Sami
Powered by blists - more mailing lists