aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2016-05-12 14:44:55 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-05-12 14:44:55 -0400
commit7d173913a6420f2818afeca70b268f064441f69b (patch)
tree6f0113ffa465a23ffdd35acd7e60c9a8ba150cc4
parent106b816cb46ebd87408b4ed99a2e16203114daa6 (diff)
perf evsel: Improve EPERM error handling in open_strerror()
We were showing a hardcoded default value for the kernel.perf_event_paranoid sysctl, now that it became more paranoid (1 -> 2 [1]), this would need to be updated, instead show the current value: [acme@jouet linux]$ perf record ls Error: You may not have permission to collect stats. Consider tweaking /proc/sys/kernel/perf_event_paranoid, which controls use of the performance events system by unprivileged users (without CAP_SYS_ADMIN). The current value is 2: -1: Allow use of (almost) all events by all users >= 0: Disallow raw tracepoint access by users without CAP_IOC_LOCK >= 1: Disallow CPU event access by users without CAP_SYS_ADMIN >= 2: Disallow kernel profiling by users without CAP_SYS_ADMIN [acme@jouet linux]$ [1] 0161028b7c8a ("perf/core: Change the default paranoia level to 2") Reported-by: Ingo Molnar <mingo@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kees Cook <keescook@chromium.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/n/tip-0gc4rdpg8d025r5not8s8028@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/util/evsel.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 738ce226002b..a5f339d447cc 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -2382,12 +2382,13 @@ int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target,
2382 "Consider tweaking /proc/sys/kernel/perf_event_paranoid,\n" 2382 "Consider tweaking /proc/sys/kernel/perf_event_paranoid,\n"
2383 "which controls use of the performance events system by\n" 2383 "which controls use of the performance events system by\n"
2384 "unprivileged users (without CAP_SYS_ADMIN).\n\n" 2384 "unprivileged users (without CAP_SYS_ADMIN).\n\n"
2385 "The default value is 1:\n\n" 2385 "The current value is %d:\n\n"
2386 " -1: Allow use of (almost) all events by all users\n" 2386 " -1: Allow use of (almost) all events by all users\n"
2387 ">= 0: Disallow raw tracepoint access by users without CAP_IOC_LOCK\n" 2387 ">= 0: Disallow raw tracepoint access by users without CAP_IOC_LOCK\n"
2388 ">= 1: Disallow CPU event access by users without CAP_SYS_ADMIN\n" 2388 ">= 1: Disallow CPU event access by users without CAP_SYS_ADMIN\n"
2389 ">= 2: Disallow kernel profiling by users without CAP_SYS_ADMIN", 2389 ">= 2: Disallow kernel profiling by users without CAP_SYS_ADMIN",
2390 target->system_wide ? "system-wide " : ""); 2390 target->system_wide ? "system-wide " : "",
2391 perf_event_paranoid());
2391 case ENOENT: 2392 case ENOENT:
2392 return scnprintf(msg, size, "The %s event is not supported.", 2393 return scnprintf(msg, size, "The %s event is not supported.",
2393 perf_evsel__name(evsel)); 2394 perf_evsel__name(evsel));