[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230819101519.568d658fbb6461cc60d348e5@kernel.org>
Date: Sat, 19 Aug 2023 10:15:19 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Francis Laniel <flaniel@...ux.microsoft.com>,
"Masami Hiramatsu (Google)" <mhiramat@...nel.org>,
linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org
Subject: Re: [RFC PATCH v1 1/1] tracing/kprobe: Add multi-probe support for
'perf_kprobe' PMU
On Fri, 18 Aug 2023 14:20:33 -0400
Steven Rostedt <rostedt@...dmis.org> wrote:
> On Fri, 18 Aug 2023 20:13:43 +0200
> Francis Laniel <flaniel@...ux.microsoft.com> wrote:
>
> > Hi.
> >
> > Le vendredi 18 août 2023, 17:41:41 CEST Steven Rostedt a écrit :
> > > On Fri, 18 Aug 2023 21:37:05 +0900
> > >
> > > Masami Hiramatsu (Google) <mhiramat@...nel.org> wrote:
> > > > That's why perf probe uses the offset from '_text'. Normal KASLR will just
> > > > moves all symbols. (Finer one will move all symbols randomely)
> > > > This should not need to access /proc/kallsyms but vmlinux or SystemMap.
> > >
> > > We could just pass in: "_text+offset" too.
> >
> > So, the idea would be to change the existing create_local_trace_kprobe() and
> > above functions to indicate the user's offset is to be used against _text and
> > not address?
>
> No, not to modify that function, but if you know the offset from _text (via
> the vmlinux), you can easily calculate it for that function.
Note that the kprobe-event PMU interface itself allows you to specify
FUNC+OFFSET style;
https://lore.kernel.org/lkml/20171206224518.3598254-5-songliubraving@fb.com/
perf_event_attr::kprobe_func = "_text";
perf_event_attr::probe_offset = OFFSET;
Then, it should be able to specify the correct one. Of course you can use
other unique symbols around the target symbol.
Thank you,
>
> I mentioned having a way to pass in the vmlinux debug info address and
> subtract the kaslr_offset from it. But that's actually unnecessary. If you
> have the address of the function you want, and the address of _text, both
> from the debug info of vmlinux, you can simply pass in "_text+offset", and
> then use kallsyms to give you _text, and add the offset to give you the
> address for create_local_trace_kprobe().
>
> -- Steve
--
Masami Hiramatsu (Google) <mhiramat@...nel.org>
Powered by blists - more mailing lists