summaryrefslogtreecommitdiffstats
path: root/arch/powerpc
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
parentdd50cf7cbc7bdd86483b797ac3d27b37d5aeeaa4 (diff)
downloadlinux-216c3087a346db8d7c8a064d2b8f0f49e4694934.tar.gz
linux-216c3087a346db8d7c8a064d2b8f0f49e4694934.tar.bz2
linux-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')
-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;