From: sashiko-bot@kernel.org
To: "Daniel Wade" <danjwade95@gmail.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] perf: Reject group leaders detached by CPU hot-unplug
Date: Mon, 16 Nov 2026 08:26:26 +0000 [thread overview]
Message-ID: <sashiko-outbox-216527@kernel.org> (raw)
In-Reply-To: <20261116081248.21059-1-danjwade95@gmail.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] perf/core: KASLR bypass via attr.ksymbol in
sys_perf_event_open() [1]
--
commit c3cb272ab78e2aa66bba3e8476259e9d9e767fba
Author: Daniel Wade <danjwade95@gmail.com>
perf: Reject group leaders detached by CPU hot-unplug
This commit rejects group leaders that are no longer attached to a context in
perf_event_open() so siblings cannot be added to leaders detached by
hot-unplug.
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 614f9f0e65005..8c2ae7d082d68 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -14288,6 +14288,18 @@ SYSCALL_DEFINE5(perf_event_open,
> goto err_locked;
> }
>
> + /*
> + * Likewise against CPU hot-unplug, which detaches the events
> + * of a CPU context and breaks up its groups without putting
> + * them in a terminal state. perf_group_detach() does nothing
> + * for a leader that is already detached, so a sibling added
> + * to one would stay linked to it after the leader is freed.
> + */
> + if (!(group_leader->attach_state & PERF_ATTACH_CONTEXT)) {
> + err = -ENODEV;
> + goto err_locked;
> + }
[Severity: Critical]
This problem wasn't introduced by this patch, but shouldn't the
perf_allow_kernel() check earlier in perf_event_open() also cover
attr.ksymbol and attr.bpf_event [1]?
An unprivileged user can open an event with exclude_kernel=1 alongside
ksymbol=1 or bpf_event=1 to bypass perf_allow_kernel():
kernel/events/core.c:SYSCALL_DEFINE5(perf_event_open) {
...
if (!attr.exclude_kernel || attr.text_poke ||
((attr.sample_type & PERF_SAMPLE_CALLCHAIN) &&
!attr.exclude_callchain_kernel)) {
err = perf_allow_kernel();
if (err)
return err;
}
...
}
When perf_event_ksymbol() or perf_event_bpf_event() later broadcasts sideband
records via perf_iterate_sb(), perf_event_ksymbol_match() and
perf_event_bpf_match() only test event->attr.ksymbol and
event->attr.bpf_event without checking exclude_kernel, leaking raw kernel
symbol and trampoline addresses to unprivileged users.
[1] https://sashiko.dev/#/bug/linux-8c1072ab-5584-4983-bcd9-f12f87444ea2
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116081248.21059-1-danjwade95@gmail.com?part=1
prev parent reply other threads:[~2026-11-16 8:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 8:12 [PATCH] perf: Reject group leaders detached by CPU hot-unplug Daniel Wade
2026-11-16 8:26 ` sashiko-bot [this message]
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=sashiko-outbox-216527@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=danjwade95@gmail.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=sashiko-reviews@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