[PATCH OLK-5.10] perf: Revert to requiring CAP_SYS_ADMIN for uprobes

From: Peter Zijlstra <peterz@infradead.org> 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=... -------------------------------- [ 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 <jannh@google.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/CAG48ez1n4520sq0XrWYDHKiKxE_+WCfAK+qt9qkY4ZiBGmL-5... Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Luo Gengkun <luogengkun2@huawei.com> --- 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; /* -- 2.34.1

反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/17327 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/ZW6... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/17327 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/ZW6...
participants (2)
-
Luo Gengkun
-
patchwork bot