aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/perf
diff options
context:
space:
mode:
authorMadhavan Srinivasan <maddy@linux.vnet.ibm.com>2019-04-16 15:18:29 +0530
committerMichael Ellerman <mpe@ellerman.id.au>2019-05-03 02:54:59 +1000
commit216c3087a346db8d7c8a064d2b8f0f49e4694934 (patch)
tree8577264a377637135b8c91ea82ab66159cd422de /arch/powerpc/perf
parentpowerpc/perf: Rearrange setting of ldbar for thread-imc (diff)
downloadlinux-dev-216c3087a346db8d7c8a064d2b8f0f49e4694934.tar.xz
linux-dev-216c3087a346db8d7c8a064d2b8f0f49e4694934.zip
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: f74c89bd80fb3 ("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>
Diffstat (limited to 'arch/powerpc/perf')
-rw-r--r--arch/powerpc/perf/imc-pmu.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c
index 23092a359ce0..975837d85a80 100644
--- a/arch/powerpc/perf/imc-pmu.c
+++ b/arch/powerpc/perf/imc-pmu.c
@@ -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;