Skip to content

Commit ba677db

Browse files
author
Peter Zijlstra
committed
perf: Revert to requiring CAP_SYS_ADMIN for uprobes
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: c9e0924 ("perf/core: open access to probes for CAP_PERFMON privileged process") Reported-by: Jann Horn <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/CAG48ez1n4520sq0XrWYDHKiKxE_+WCfAK+qt9qkY4ZiBGmL-5g@mail.gmail.com
1 parent 7b4c5a3 commit ba677db

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/events/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11116,7 +11116,7 @@ static int perf_uprobe_event_init(struct perf_event *event)
1111611116
if (event->attr.type != perf_uprobe.type)
1111711117
return -ENOENT;
1111811118

11119-
if (!perfmon_capable())
11119+
if (!capable(CAP_SYS_ADMIN))
1112011120
return -EACCES;
1112111121

1112211122
/*

0 commit comments

Comments
 (0)