Re: [PATCH 4/4] perf-probe: Warn if the target function is GNU Indirect function

From: Masami Hiramatsu
Date: Fri Jul 10 2020 - 08:14:29 EST


On Fri, 10 Jul 2020 16:45:12 +0530
Srikar Dronamraju <srikar@xxxxxxxxxxxxxxxxxx> wrote:

> * Masami Hiramatsu <mhiramat@xxxxxxxxxx> [2020-07-09 17:07:31]:
>
> > Reported-by: Andi Kleen <andi@xxxxxxxxxxxxxx>
> > Signed-off-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
> > ---
> > tools/perf/util/probe-event.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> > index 1e95a336862c..671176d39569 100644
> > --- a/tools/perf/util/probe-event.c
> > +++ b/tools/perf/util/probe-event.c
> > @@ -379,6 +379,11 @@ static int find_alternative_probe_point(struct debuginfo *dinfo,
> > address = sym->start;
> > else
> > address = map->unmap_ip(map, sym->start) - map->reloc;
> > + if (sym->type == STT_GNU_IFUNC) {
> > + pr_warning("Warning: The probe address (0x%lx) is in a GNU indirect function.\n"
> > + "This may not work as you expected unless you intend to probe the indirect function.\n",
> > + (unsigned long)address);
> > + }
>
> Are these GNU indirect functions possible in kernel? If not we could move
> this warning under if (uprobes)

OK, I'll move it under if (uprobes).

>
> Also instead of printing the address, can we print the pp->function?

Hmm, OK. But it may not help user because the pp->function will the name
specified by user...

Thank you,


--
Masami Hiramatsu <mhiramat@xxxxxxxxxx>