perf, x86: Restrict the ANY flag
[linux-2.6.git] / arch / x86 / kernel / cpu / perf_event.c
index 6531b4b..aab2e1c 100644 (file)
@@ -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;
        }