[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-5380c1056d267eff49854c1fa03399bfe761da1e@git.kernel.org>
Date: Wed, 2 Sep 2009 19:51:37 GMT
From: tip-bot for Ingo Molnar <mingo@...e.hu>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, acme@...hat.com, paulus@...ba.org,
hpa@...or.com, mingo@...hat.com, a.p.zijlstra@...llo.nl,
efault@....de, fweisbec@...il.com, tglx@...utronix.de,
mingo@...e.hu
Subject: [tip:perfcounters/core] perf_counter: Introduce new (non-)paranoia level to allow raw tracepoint access
Commit-ID: 5380c1056d267eff49854c1fa03399bfe761da1e
Gitweb: http://git.kernel.org/tip/5380c1056d267eff49854c1fa03399bfe761da1e
Author: Ingo Molnar <mingo@...e.hu>
AuthorDate: Wed, 2 Sep 2009 21:46:00 +0200
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Wed, 2 Sep 2009 21:47:06 +0200
perf_counter: Introduce new (non-)paranoia level to allow raw tracepoint access
I want to sample inherited tracepoint workloads as a normal
user and the CAP_SYS_ADMIN check prevents me from doing that
right now.
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Mike Galbraith <efault@....de>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
kernel/perf_counter.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index d988dfb..53ca946 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -46,12 +46,18 @@ static atomic_t nr_task_counters __read_mostly;
/*
* perf counter paranoia level:
- * 0 - not paranoid
- * 1 - disallow cpu counters to unpriv
- * 2 - disallow kernel profiling to unpriv
+ * -1 - not paranoid at all
+ * 0 - disallow raw tracepoint access for unpriv
+ * 1 - disallow cpu counters for unpriv
+ * 2 - disallow kernel profiling for unpriv
*/
int sysctl_perf_counter_paranoid __read_mostly = 1;
+static inline bool perf_paranoid_tracepoint_raw(void)
+{
+ return sysctl_perf_counter_paranoid > -1;
+}
+
static inline bool perf_paranoid_cpu(void)
{
return sysctl_perf_counter_paranoid > 0;
@@ -3971,6 +3977,7 @@ static const struct pmu *tp_perf_counter_init(struct perf_counter *counter)
* have these.
*/
if ((counter->attr.sample_type & PERF_SAMPLE_RAW) &&
+ && perf_paranoid_tracepoint_raw() &&
!capable(CAP_SYS_ADMIN))
return ERR_PTR(-EPERM);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists