[PATCH] nm: fix treating an ifunc symbol as a stab if '--ifunc-chars=--' is given
Dmitry Klochkov
dmitry.klochkov@bell-sw.com
Fri Sep 5 16:28:24 GMT 2025
Hi H.J,
On Fri, Sep 05, 2025 at 07:40:31AM -0700, H.J. Lu wrote:
> On Fri, Sep 5, 2025 at 7:27 AM Jan Beulich <jbeulich@suse.com> wrote:
> >
> > On 05.09.2025 16:17, H.J. Lu wrote:
> > > On Fri, Sep 5, 2025 at 6:38 AM Dmitry Klochkov
> > > <dmitry.klochkov@bell-sw.com> wrote:
> > >>
> > >> If an ifunc symbol is processed in print_symbol(), a 'type' field of a
> > >> 'syminfo' structure is set to any character specified by a user with an
> > >> '--ifunc-chars' option. But afterwards the 'type' field is used to
> > >> check whether a symbol is a stab in print_symbol_info_{bsd,sysv}()
> > >> functions in order to print additional stab related data. If the 'type'
> > >> field equals '-', a symbol is treated as a stab. If '--ifunc-chars=--'
> > >> is given, all ifunc symbols will be treated as stab symbols and
> > >> uninitialized stab related fields of the 'syminfo' structure will be
> > >> printed which can lead to segmentation fault.
> > >>
> > >> To fix this, check if a symbol is a stab before override the 'type'
> > >> field. Also, add a test case for this fix.
> > >>
> > >> PR binutils/32556
> > >> * nm.c (extended_symbol_info): Add is_stab.
> > >> (print_symbol): Check if a symbol is a stab.
> > >> (print_symbol_info_bsd): Use info->is_stab.
> > >> (print_symbol_info_sysv): Use info->is_stab.
> > >> * testsuite/binutils-all/nm.exp: Test nm --ifunc-chars=--.
> > >
> > > Need a test to show what it does.
> >
> > You comment on the line documenting the test that is being added that a
> > test needs to be added? Odd, to say the least.
> >
> > Jan
>
> I see.
Looks like it was misreading on your part. Anyway, I've just realized
my test is not strict enough. I am going to fix it in the v2 patch.
Thanks,
Dmitry
More information about the Binutils
mailing list