From: Anju T Sudhakar <anju@linux.vnet.ibm.com>
To: mpe@ellerman.id.au, linux-kernel@vger.kernel.org
Cc: maddy@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org,
anju@linux.vnet.ibm.com
Subject: [PATCH v2 3/5] powerpc/perf: Add privileged access check for thread_imc
Date: Fri, 14 Dec 2018 14:41:20 +0530 [thread overview]
Message-ID: <20181214091122.20992-4-anju@linux.vnet.ibm.com> (raw)
In-Reply-To: <20181214091122.20992-1-anju@linux.vnet.ibm.com>
From: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
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>
---
arch/powerpc/perf/imc-pmu.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c
index 3bef46f8417d..5ca80545a849 100644
--- a/arch/powerpc/perf/imc-pmu.c
+++ b/arch/powerpc/perf/imc-pmu.c
@@ -877,6 +877,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;
--
2.17.1
next prev parent reply other threads:[~2018-12-14 9:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-14 9:11 [PATCH v2 0/5] powerpc/perf: IMC trace-mode support Anju T Sudhakar
2018-12-14 9:11 ` [PATCH v2 1/5] powerpc/include: Add data structures and macros for IMC trace mode Anju T Sudhakar
2018-12-19 6:04 ` Madhavan Srinivasan
2018-12-14 9:11 ` [PATCH v2 2/5] powerpc/perf: Rearrange setting of ldbar for thread-imc Anju T Sudhakar
2018-12-19 6:06 ` Madhavan Srinivasan
2018-12-14 9:11 ` Anju T Sudhakar [this message]
2018-12-14 9:11 ` [PATCH v2 4/5] powerpc/perf: Trace imc events detection and cpuhotplug Anju T Sudhakar
2018-12-19 6:08 ` Madhavan Srinivasan
2018-12-14 9:11 ` [PATCH v2 5/5] powerpc/perf: Trace imc PMU functions Anju T Sudhakar
2018-12-19 6:09 ` Madhavan Srinivasan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181214091122.20992-4-anju@linux.vnet.ibm.com \
--to=anju@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.vnet.ibm.com \
--cc=mpe@ellerman.id.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).