From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932071AbcEMJTO (ORCPT ); Fri, 13 May 2016 05:19:14 -0400 Received: from terminus.zytor.com ([198.137.202.10]:37408 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751604AbcEMJTK (ORCPT ); Fri, 13 May 2016 05:19:10 -0400 Date: Fri, 13 May 2016 02:18:25 -0700 From: tip-bot for Arnaldo Carvalho de Melo Message-ID: Cc: keescook@chromium.org, acme@redhat.com, hpa@zytor.com, mingo@kernel.org, dsahern@gmail.com, wangnan0@huawei.com, adrian.hunter@intel.com, linux-kernel@vger.kernel.org, jolsa@kernel.org, tglx@linutronix.de, torvalds@linux-foundation.org, luto@kernel.org, peterz@infradead.org, mhiramat@kernel.org, namhyung@kernel.org Reply-To: mhiramat@kernel.org, luto@kernel.org, peterz@infradead.org, namhyung@kernel.org, jolsa@kernel.org, tglx@linutronix.de, torvalds@linux-foundation.org, wangnan0@huawei.com, linux-kernel@vger.kernel.org, adrian.hunter@intel.com, acme@redhat.com, keescook@chromium.org, dsahern@gmail.com, hpa@zytor.com, mingo@kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf evsel: Improve EPERM error handling in open_strerror() Git-Commit-ID: 7d173913a6420f2818afeca70b268f064441f69b X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 7d173913a6420f2818afeca70b268f064441f69b Gitweb: http://git.kernel.org/tip/7d173913a6420f2818afeca70b268f064441f69b Author: Arnaldo Carvalho de Melo AuthorDate: Thu, 12 May 2016 15:44:55 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 12 May 2016 15:44:55 -0300 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 Cc: Adrian Hunter Cc: Andy Lutomirski Cc: David Ahern Cc: Jiri Olsa Cc: Kees Cook Cc: Linus Torvalds Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Wang Nan Link: http://lkml.kernel.org/n/tip-0gc4rdpg8d025r5not8s8028@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/evsel.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 738ce22..a5f339d 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, "Consider tweaking /proc/sys/kernel/perf_event_paranoid,\n" "which controls use of the performance events system by\n" "unprivileged users (without CAP_SYS_ADMIN).\n\n" - "The default value is 1:\n\n" + "The current value is %d:\n\n" " -1: Allow use of (almost) all events by all users\n" ">= 0: Disallow raw tracepoint access by users without CAP_IOC_LOCK\n" ">= 1: Disallow CPU event access by users without CAP_SYS_ADMIN\n" ">= 2: Disallow kernel profiling by users without CAP_SYS_ADMIN", - target->system_wide ? "system-wide " : ""); + target->system_wide ? "system-wide " : "", + perf_event_paranoid()); case ENOENT: return scnprintf(msg, size, "The %s event is not supported.", perf_evsel__name(evsel));