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

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
...@@ -864,6 +864,9 @@ static int thread_imc_event_init(struct perf_event *event) ...@@ -864,6 +864,9 @@ static int thread_imc_event_init(struct perf_event *event)
if (event->attr.type != event->pmu->type) if (event->attr.type != event->pmu->type)
return -ENOENT; return -ENOENT;
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
/* Sampling not supported */ /* Sampling not supported */
if (event->hw.sample_period) if (event->hw.sample_period)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment