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, 16 Aug 2023 20:52:03 +0000 (21:52 +0100)
commit6917d40f26f46e1f8e458608cc6c1efbb8e0cc4b
treeb84e8a6b25e46b0ca23d242ed113dc191dcb59e3
parentf4ae578359c257df39a3ec5c061bbebd0961c8f0
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