[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-32e6e967fb36bf77ed99221ae3ce1909f045d8f9@git.kernel.org>
Date: Thu, 12 Apr 2018 02:22:11 -0700
From: tip-bot for Song Liu <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: songliubraving@...com, mingo@...nel.org,
linux-kernel@...r.kernel.org, torvalds@...ux-foundation.org,
hpa@...or.com, vincent.weaver@...ne.edu, tglx@...utronix.de,
peterz@...radead.org
Subject: [tip:perf/urgent] perf/core: Need CAP_SYS_ADMIN to create k/uprobe
with perf_event_open()
Commit-ID: 32e6e967fb36bf77ed99221ae3ce1909f045d8f9
Gitweb: https://git.kernel.org/tip/32e6e967fb36bf77ed99221ae3ce1909f045d8f9
Author: Song Liu <songliubraving@...com>
AuthorDate: Wed, 11 Apr 2018 18:02:37 +0000
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Thu, 12 Apr 2018 09:55:50 +0200
perf/core: Need CAP_SYS_ADMIN to create k/uprobe with perf_event_open()
Non-root user cannot create kprobe or uprobe through the text-based
interface (kprobe_events, uprobe_events),so they should not be able
to create probes via perf_event_open() either.
Reported-by: Vince Weaver <vincent.weaver@...ne.edu>
Signed-off-by: Song Liu <songliubraving@...com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Fixes: 33ea4b24277b ("perf/core: Implement the 'perf_uprobe' PMU")
Fixes: e12f03d7031a ("perf/core: Implement the 'perf_kprobe' PMU")
Link: http://lkml.kernel.org/r/C0B2EFB5-C403-4BDB-9046-C14B3EE66999@fb.com
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
kernel/events/core.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index d7af82827373..2d5fe26551f8 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -8400,6 +8400,10 @@ static int perf_kprobe_event_init(struct perf_event *event)
if (event->attr.type != perf_kprobe.type)
return -ENOENT;
+
+ if (!capable(CAP_SYS_ADMIN))
+ return -EACCES;
+
/*
* no branch sampling for probe events
*/
@@ -8437,6 +8441,10 @@ static int perf_uprobe_event_init(struct perf_event *event)
if (event->attr.type != perf_uprobe.type)
return -ENOENT;
+
+ if (!capable(CAP_SYS_ADMIN))
+ return -EACCES;
+
/*
* no branch sampling for probe events
*/
Powered by blists - more mailing lists