security,perf: Allow further restriction of perf_event_open
authorBen Hutchings <ben@decadent.org.uk>
Mon, 11 Jan 2016 15:23:55 +0000 (15:23 +0000)
committerSalvatore Bonaccorso <carnil@debian.org>
Mon, 7 Mar 2022 21:06:21 +0000 (21:06 +0000)
commita03a9ad755f1918e5467c5c71f65c0006c909139
tree9a6d21b7f597dc9e42d1ae62d027b6f81d6c1ead
parent5daa492d65a30a753f37549be7b791525fa8aec8
security,perf: Allow further restriction of perf_event_open

Forwarded: https://lkml.org/lkml/2016/1/11/587

When kernel.perf_event_open is set to 3 (or greater), disallow all
access to performance events by users without CAP_SYS_ADMIN.
Add a Kconfig symbol CONFIG_SECURITY_PERF_EVENTS_RESTRICT that
makes this value the default.

This is based on a similar feature in grsecurity
(CONFIG_GRKERNSEC_PERF_HARDEN).  This version doesn't include making
the variable read-only.  It also allows enabling further restriction
at run-time regardless of whether the default is changed.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Topic features/all
Gbp-Pq: Name security-perf-allow-further-restriction-of-perf_event_open.patch
include/linux/perf_event.h
kernel/events/core.c
security/Kconfig