summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/perf_event.c
diff options
context:
space:
mode:
authorPeter Zijlstra2010-03-02 12:35:37 +0100
committerIngo Molnar2010-03-02 15:06:46 +0100
commit320ebf09cbb6d01954c9a060266aa8e0d27f4638 (patch)
tree0069898e64171dd89834327b0180c6d90860b46a /arch/x86/kernel/cpu/perf_event.c
parentperf, x86: rename macro in ARCH_PERFMON_EVENTSEL_ENABLE (diff)
downloadkernel-qcow2-linux-320ebf09cbb6d01954c9a060266aa8e0d27f4638.tar.gz
kernel-qcow2-linux-320ebf09cbb6d01954c9a060266aa8e0d27f4638.tar.xz
kernel-qcow2-linux-320ebf09cbb6d01954c9a060266aa8e0d27f4638.zip
perf, x86: Restrict the ANY flag
The ANY flag can show SMT data of another task (like 'top'), so we want to disable it when system-wide profiling is disabled. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/cpu/perf_event.c')
-rw-r--r--arch/x86/kernel/cpu/perf_event.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 6531b4bdb22d..aab2e1ce9dee 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -503,6 +503,9 @@ static int __hw_perf_event_init(struct perf_event *event)
*/
if (attr->type == PERF_TYPE_RAW) {
hwc->config |= x86_pmu.raw_event(attr->config);
+ if ((hwc->config & ARCH_PERFMON_EVENTSEL_ANY) &&
+ perf_paranoid_cpu() && !capable(CAP_SYS_ADMIN))
+ return -EACCES;
return 0;
}