Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1306397 > unrolled thread

[PATCH 0/2] Document and extend kernel.perf_event_paranoid

Started byBen Hutchings <ben@decadent.org.uk>
First post2016-01-11 16:30 +0100
Last post2016-01-11 16:30 +0100
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/2] Document and extend kernel.perf_event_paranoid Ben Hutchings <ben@decadent.org.uk> - 2016-01-11 16:30 +0100
    [PATCH 1/2] Documentation,perf: Document the perf sysctls Ben Hutchings <ben@decadent.org.uk> - 2016-01-11 16:30 +0100

#1306397 — [PATCH 0/2] Document and extend kernel.perf_event_paranoid

FromBen Hutchings <ben@decadent.org.uk>
Date2016-01-11 16:30 +0100
Subject[PATCH 0/2] Document and extend kernel.perf_event_paranoid
Message-ID<qPMzU-4ae-19@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

This moves documentation for the kernel.perf_event_paranoid to the
Documentation directory, then adds a more paranoid level.

Ben.

Ben Hutchings (2):
  Documentation,perf: Document the perf sysctls
  security,perf: Allow further restriction of perf_event_open

 Documentation/sysctl/kernel.txt | 15 +++++++++++++++
 include/linux/perf_event.h      |  5 +++++
 kernel/events/core.c            |  8 ++++++++
 security/Kconfig                |  9 +++++++++
 tools/perf/util/evsel.c         |  7 ++-----
 5 files changed, 39 insertions(+), 5 deletions(-)

[toc] | [next] | [standalone]


#1306412 — [PATCH 1/2] Documentation,perf: Document the perf sysctls

FromBen Hutchings <ben@decadent.org.uk>
Date2016-01-11 16:30 +0100
Subject[PATCH 1/2] Documentation,perf: Document the perf sysctls
Message-ID<qPMzW-4ae-61@gated-at.bofh.it>
In reply to#1306397

[Multipart message — attachments visible in raw view] — view raw

perf_event_paranoid was only documented in source code and a perf
error message.  Move the documentation from the error message to
Documentation/sysctl/kernel.txt.

perf_cpu_time_max_percent was already documented but missing from the
list at the top, so add it there.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 Documentation/sysctl/kernel.txt | 13 +++++++++++++
 tools/perf/util/evsel.c         |  7 ++-----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt
index af70d15..88a2c8e 100644
--- a/Documentation/sysctl/kernel.txt
+++ b/Documentation/sysctl/kernel.txt
@@ -58,6 +58,8 @@ show up in /proc/sys/kernel:
 - panic_on_stackoverflow
 - panic_on_unrecovered_nmi
 - panic_on_warn
+- perf_cpu_time_max_percent
+- perf_event_paranoid
 - pid_max
 - powersave-nap               [ PPC only ]
 - printk
@@ -624,6 +626,17 @@ allowed to execute.
 
 ==============================================================
 
+perf_event_paranoid:
+
+Controls use of the performance events system by unprivileged
+users (without CAP_SYS_ADMIN).  The default value is 1.
+
+ -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
+
+==============================================================
 
 pid_max:
 
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 397fb4e..9b4df11 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -2314,11 +2314,8 @@ int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target,
 	case EACCES:
 		return scnprintf(msg, size,
 		 "You may not have permission to collect %sstats.\n"
-		 "Consider tweaking /proc/sys/kernel/perf_event_paranoid:\n"
-		 " -1 - Not paranoid at all\n"
-		 "  0 - Disallow raw tracepoint access for unpriv\n"
-		 "  1 - Disallow cpu events for unpriv\n"
-		 "  2 - Disallow kernel profiling for unpriv",
+		 "Consider tweaking /proc/sys/kernel/perf_event_paranoid -\n"
+		 "see Documentation/sysctl/kernel.txt",
 				 target->system_wide ? "system-wide " : "");
 	case ENOENT:
 		return scnprintf(msg, size, "The %s event is not supported.",

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web