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: f74c89bd80 ("powerpc/perf: Add thread IMC PMU support")
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
Madhavan Srinivasan 2019-04-16 15:18:29 +05:30 committed by Michael Ellerman
parent dd50cf7cbc
commit 216c3087a3

View file

@ -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;