Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 216c3087 authored by Madhavan Srinivasan's avatar Madhavan Srinivasan Committed by Michael Ellerman
Browse files

powerpc/perf: Add privileged access check for thread_imc



Add code to restrict user access to thread_imc pmu since
some event report privilege level information.

Fixes: f74c89bd ("powerpc/perf: Add thread IMC PMU support")
Signed-off-by: default avatarMadhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: default avatarAnju T Sudhakar <anju@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent dd50cf7c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -864,6 +864,9 @@ static int thread_imc_event_init(struct perf_event *event)
	if (event->attr.type != event->pmu->type)
		return -ENOENT;

	if (!capable(CAP_SYS_ADMIN))
		return -EACCES;

	/* Sampling not supported */
	if (event->hw.sample_period)
		return -EINVAL;