From: sashiko-bot@kernel.org
To: "Anubhav Shelat" <ashelat@redhat.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v3 1/3] perf evsel: don't set PERF_SAMPLE_IP for unprivileged tracepoints
Date: Thu, 23 Apr 2026 22:14:47 +0000 [thread overview]
Message-ID: <20260423221448.9BB01C2BCAF@smtp.kernel.org> (raw)
In-Reply-To: <20260423151746.16258-2-ashelat@redhat.com>
Sashiko AI review found 1 potential issue(s):
- [High] Unconditionally dropping PERF_SAMPLE_IP for unprivileged tracepoints breaks user-space dynamic tracing (uprobes and USDTs).
--
commit 06030eb0792514412c01e8660eaafa6292e09335
Author: Anubhav Shelat <ashelat@redhat.com>
perf evsel: don't set PERF_SAMPLE_IP for unprivileged tracepoints
This commit conditionally drops the PERF_SAMPLE_IP bit for tracepoint events
configured by unprivileged users. It aims to prevent exposing kernel addresses
that might reveal the KASLR base offset.
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index f59228c1a39eb..a1091d937ff92 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
[ ... ]
> @@ -1503,7 +1503,9 @@ void evsel__config(struct evsel *evsel, struct record_opts *opts,
> attr->write_backward = opts->overwrite ? 1 : 0;
> attr->read_format = PERF_FORMAT_LOST;
>
> - evsel__set_sample_bit(evsel, IP);
> + if (attr->type != PERF_TYPE_TRACEPOINT || perf_event_paranoid_check(1))
> + evsel__set_sample_bit(evsel, IP);
> +
Uprobes and USDTs are also registered as PERF_TYPE_TRACEPOINT events, but their
instruction pointer is a safe user-space address indicating where the breakpoint
fired, rather than a kernel address that could leak KASLR.
By unconditionally skipping the IP bit for all tracepoints when executed by
an unprivileged user, downstream tools might fail to resolve symbols
or attribute hits to specific instructions for user-space events.
Does this inadvertently break user-space dynamic tracing?
> evsel__set_sample_bit(evsel, TID);
>
> if (evsel->sample_read) {
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260423151746.16258-1-ashelat@redhat.com?part=1
next prev parent reply other threads:[~2026-04-23 22:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-23 15:17 [PATCH v3 0/3] Enable perf tracing for unprivileged users Anubhav Shelat
2026-04-23 15:17 ` [PATCH v3 1/3] perf evsel: don't set PERF_SAMPLE_IP for unprivileged tracepoints Anubhav Shelat
2026-04-23 22:14 ` sashiko-bot [this message]
2026-04-23 15:17 ` [PATCH v3 2/3] perf: enable unprivileged syscall tracing with perf trace Anubhav Shelat
2026-04-23 23:10 ` sashiko-bot
2026-04-23 15:17 ` [PATCH v3 3/3] tracefs: make root directory world-traversable Anubhav Shelat
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=20260423221448.9BB01C2BCAF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=ashelat@redhat.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=sashiko@lists.linux.dev \
/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