From 3eb2b5278f09b0a006acc03c7274c428dccfa24b Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Tue, 29 Jul 2025 03:20:52 +0000 Subject: [PATCH] perf: Revert to requiring CAP_SYS_ADMIN for uprobes stable inclusion from stable-v6.6.99 commit 183bdb89af1b5193b1d1d9316986053b15ca6fa4 category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/ICOXOV CVE: CVE-2025-38466 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=183bdb89af1b5193b1d1d9316986053b15ca6fa4 -------------------------------- [ Upstream commit ba677dbe77af5ffe6204e0f3f547f3ba059c6302 ] Jann reports that uprobes can be used destructively when used in the middle of an instruction. The kernel only verifies there is a valid instruction at the requested offset, but due to variable instruction length cannot determine if this is an instruction as seen by the intended execution stream. Additionally, Mark Rutland notes that on architectures that mix data in the text segment (like arm64), a similar things can be done if the data word is 'mistaken' for an instruction. As such, require CAP_SYS_ADMIN for uprobes. Fixes: c9e0924e5c2b ("perf/core: open access to probes for CAP_PERFMON privileged process") Reported-by: Jann Horn Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/CAG48ez1n4520sq0XrWYDHKiKxE_+WCfAK+qt9qkY4ZiBGmL-5g@mail.gmail.com Signed-off-by: Sasha Levin Signed-off-by: Luo Gengkun --- kernel/events/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index f042d6101932..4785d7f68a2b 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -10418,7 +10418,7 @@ static int perf_uprobe_event_init(struct perf_event *event) if (event->attr.type != perf_uprobe.type) return -ENOENT; - if (!perfmon_capable()) + if (!capable(CAP_SYS_ADMIN)) return -EACCES; /* -- Gitee