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, 24 Feb 2025 01:11:58 +0000 (02:11 +0100)
commit3619bb9df0e8bf5c50a0ca40e17c68295d1ae9fd
treee5d36d9d1c71d9603dd875eaafb5a7bed06a6da0
parent4fa3f8800a85757e854edbdfcd432b00f376fca7
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