diff options
author | Madhavan Srinivasan <maddy@linux.vnet.ibm.com> | 2019-04-16 12:48:29 +0300 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2019-05-02 19:54:59 +0300 |
commit | 216c3087a346db8d7c8a064d2b8f0f49e4694934 (patch) | |
tree | 8577264a377637135b8c91ea82ab66159cd422de /arch/powerpc/perf | |
parent | dd50cf7cbc7bdd86483b797ac3d27b37d5aeeaa4 (diff) | |
download | linux-216c3087a346db8d7c8a064d2b8f0f49e4694934.tar.xz |
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.c | 3 |
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; |