aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-08-10 05:20:12 -0400
committerIngo Molnar <mingo@elte.hu>2009-08-10 05:33:09 -0400
commita4e95fc2cbb31d70a65beffeaf8773f881328c34 (patch)
treec0a00094c9c38bad5e09fd19fe23521c361177d7 /kernel
parenta044560c3a1f0ad75ce685c1ed7604820b9ed319 (diff)
perf_counter: Require CAP_SYS_ADMIN for raw tracepoint data
Raw tracepoint data contains various kernel internals and data from other users, so restrict this to CAP_SYS_ADMIN. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> LKML-Reference: <1249896452.17467.75.camel@twins> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/perf_counter.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 5229d1666fa5..b0b20a07f394 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -3787,6 +3787,14 @@ static void tp_perf_counter_destroy(struct perf_counter *counter)
3787 3787
3788static const struct pmu *tp_perf_counter_init(struct perf_counter *counter) 3788static const struct pmu *tp_perf_counter_init(struct perf_counter *counter)
3789{ 3789{
3790 /*
3791 * Raw tracepoint data is a severe data leak, only allow root to
3792 * have these.
3793 */
3794 if ((counter->attr.sample_type & PERF_SAMPLE_RAW) &&
3795 !capable(CAP_SYS_ADMIN))
3796 return ERR_PTR(-EPERM);
3797
3790 if (ftrace_profile_enable(counter->attr.config)) 3798 if (ftrace_profile_enable(counter->attr.config))
3791 return NULL; 3799 return NULL;
3792 3800