diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2016-09-19 23:27:58 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-09-19 23:27:58 -0700 |
| commit | b7d007f82edfd91d2fe1ad43985e18a72742ddb3 (patch) | |
| tree | 145a0b16c0198520c20f3ec7996b531a1f01d170 /kernel | |
| parent | f6ee052d8011b249e34d782e018bfa222b78a8e3 (diff) | |
| parent | 1a565f59cb3b227e0c7c1c5b58951aed5a27b5d6 (diff) | |
Merge "FROMLIST: security,perf: Allow further restriction of perf_event_open"
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/events/core.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c index 32e2617d654f..d6ec580584b6 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -176,9 +176,12 @@ static struct srcu_struct pmus_srcu; * 0 - disallow raw tracepoint access for unpriv * 1 - disallow cpu events for unpriv * 2 - disallow kernel profiling for unpriv + * 3 - disallow all unpriv perf event use */ #ifdef CONFIG_PERF_EVENTS_USERMODE int sysctl_perf_event_paranoid __read_mostly = -1; +#elif defined CONFIG_SECURITY_PERF_EVENTS_RESTRICT +int sysctl_perf_event_paranoid __read_mostly = 3; #else int sysctl_perf_event_paranoid __read_mostly = 1; #endif @@ -8325,6 +8328,9 @@ SYSCALL_DEFINE5(perf_event_open, if (flags & ~PERF_FLAG_ALL) return -EINVAL; + if (perf_paranoid_any() && !capable(CAP_SYS_ADMIN)) + return -EACCES; + err = perf_copy_attr(attr_uptr, &attr); if (err) return err; |
