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>
Wed, 10 Aug 2022 18:11:48 +0000 (19:11 +0100)
commit77bbec2eb2f2f4bc01759cf09e7ffc1787619b69
tree3e1e024b2e9655a264ce7c9b7b635974eab027a0
parent5c4118196b527b2578eba64cc8c1e5d88de4edaa
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