From 0cbea1e8816c826ac82b0a260e6262bd03515d53 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Tue, 29 Jul 2025 03:20:02 +0000 Subject: [PATCH] perf: Revert to requiring CAP_SYS_ADMIN for uprobes stable inclusion from stable-v5.10.240 commit d7ef1afd5b3f43f4924326164cee5397b66abd9c 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=d7ef1afd5b3f43f4924326164cee5397b66abd9c -------------------------------- [ 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 7b185e630e08..1ca8ecdabbe3 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -9667,7 +9667,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