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)
committerBen Hutchings <benh@debian.org>
Mon, 19 May 2025 17:24:37 +0000 (19:24 +0200)
commit703ab57ab4a81d45d147e7d313951e5a9da36ec2
tree3eb1c6367c6f8efc100cededba23caf310e495f9
parent86e46007c006e364684fdf4d6f68af81454b135d
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