From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Song Liu <song@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Francis Laniel <flaniel@linux.microsoft.com>,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v1 1/1] tracing/kprobe: Add multi-probe support for 'perf_kprobe' PMU
Date: Sun, 20 Aug 2023 22:16:12 +0900 [thread overview]
Message-ID: <20230820221612.33dfc3b3072f8bd8517f95b5@kernel.org> (raw)
In-Reply-To: <CAPhsuW73yT+D9HhLhi8pafYZsgT=qsqk5foAwGRTvStnWCZwNA@mail.gmail.com>
On Sun, 20 Aug 2023 03:02:18 -0700
Song Liu <song@kernel.org> wrote:
> On Sun, Aug 20, 2023 at 2:32 AM Masami Hiramatsu <mhiramat@kernel.org> wrote:
> >
> [...]
> > > >
> > > > 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.
> > >
> > > Trying to catch up with the thread.
> >
> > Thanks for your reply :)
> >
> > >
> > > Besides the CAP_* issue, we can do this with
> > >
> > > perf_event_attr::kprobe_func = NULL;
> > > perf_event_attr::kprobe_addr = address;
> >
> > As I pointed, you don't need actual address, instead, you can specify the
> > probe point via "unique symbol" + offset.
>
> Technically, this works. But it is weird to me.
It's not so weired because it is a relative address, e.g. from _text,
this means "the address in the text section". And perf probe already
uses it a while.
> > >
> > > Then for the CAP_*, I think we should give CAP_PERFMON access to
> > > /proc/kallsyms. Would this work?
> >
> > For the "unique symbol" + offset, you don't need the kallsyms, but need to
> > access the System.map or vmlinux image. In this case, we don't need to expand
> > the CAP_PERFMON capabilities.
>
> I agree this is not needed in this case. But I wonder whether it makes sense
> to give CAP_PERFMON access to /proc/kallsyms. Will this change make
> CAP_PERFMON less secure?
Yes, because /proc/kallsyms will expose the real address of the all
symbols, which makes KASLR useless. But on the other hand, it maybe
already useless because BPF program can read any real address, right?
Hmm, from this point of view, is the CAP_PERFMON meaningful?
(maybe it can avoid loading modules etc.)
Thank you,
>
> Thanks,
> Song
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
next prev parent reply other threads:[~2023-08-20 13:19 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230816163517.112518-1-flaniel@linux.microsoft.com>
2023-08-16 16:35 ` [RFC PATCH v1 1/1] tracing/kprobe: Add multi-probe support for 'perf_kprobe' PMU Francis Laniel
2023-08-16 18:42 ` Steven Rostedt
2023-08-17 10:59 ` Francis Laniel
2023-08-17 15:13 ` Steven Rostedt
2023-08-18 9:01 ` Francis Laniel
2023-08-18 12:37 ` Masami Hiramatsu
2023-08-18 15:41 ` Steven Rostedt
2023-08-18 18:13 ` Francis Laniel
2023-08-18 18:20 ` Steven Rostedt
2023-08-19 1:15 ` Masami Hiramatsu
2023-08-19 15:22 ` Song Liu
2023-08-20 9:32 ` Masami Hiramatsu
2023-08-20 10:02 ` Song Liu
2023-08-20 13:16 ` Masami Hiramatsu [this message]
2023-08-21 6:09 ` Song Liu
2023-08-21 10:01 ` Masami Hiramatsu
2023-08-21 14:45 ` Steven Rostedt
2023-08-21 18:07 ` Kees Cook
2023-08-21 14:29 ` Steven Rostedt
2023-08-21 15:19 ` Masami Hiramatsu
2023-08-21 15:28 ` Steven Rostedt
2023-08-17 7:50 ` Masami Hiramatsu
2023-08-17 11:06 ` Francis Laniel
2023-08-18 13:05 ` Masami Hiramatsu
2023-08-18 18:12 ` Francis Laniel
2023-08-19 1:11 ` Masami Hiramatsu
2023-08-20 20:23 ` Jiri Olsa
2023-08-21 12:22 ` Francis Laniel
2023-08-20 20:34 ` Jiri Olsa
2023-08-21 12:24 ` Francis Laniel
2023-08-22 13:13 ` Jiri Olsa
2023-08-21 12:55 ` Francis Laniel
2023-08-23 0:36 ` Masami Hiramatsu
2023-08-23 9:54 ` Francis Laniel
2023-08-23 13:45 ` Masami Hiramatsu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230820221612.33dfc3b3072f8bd8517f95b5@kernel.org \
--to=mhiramat@kernel.org \
--cc=flaniel@linux.microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=song@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).