linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anju T Sudhakar <anju@linux.vnet.ibm.com>
To: mpe@ellerman.id.au
Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	maddy@linux.vnet.ibm.com, anju@linux.vnet.ibm.com
Subject: [PATCH v4 3/5] powerpc/perf: Add privileged access check for thread_imc
Date: Mon, 15 Apr 2019 15:42:02 +0530	[thread overview]
Message-ID: <20190415101204.15125-4-anju@linux.vnet.ibm.com> (raw)
In-Reply-To: <20190415101204.15125-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 51f1d3eaaa6d..7fe258e17dfe 100644
--- a/arch/powerpc/perf/imc-pmu.c
+++ b/arch/powerpc/perf/imc-pmu.c
@@ -859,6 +859,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.2


  parent reply	other threads:[~2019-04-15 10:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-15 10:11 [PATCH v4 0/5] powerpc/perf: IMC trace-mode support Anju T Sudhakar
2019-04-15 10:12 ` [PATCH v4 1/5] powerpc/include: Add data structures and macros for IMC trace mode Anju T Sudhakar
2019-04-15 10:12 ` [PATCH v4 2/5] powerpc/perf: Rearrange setting of ldbar for thread-imc Anju T Sudhakar
2019-04-15 10:12 ` Anju T Sudhakar [this message]
2019-04-15 10:12 ` [PATCH v4 4/5] powerpc/perf: Trace imc events detection and cpuhotplug Anju T Sudhakar
2019-04-15 10:12 ` [PATCH v4 5/5] powerpc/perf: Trace imc PMU functions Anju T Sudhakar
2019-04-16  9:44 ` [PATCH v4 0/5] powerpc/perf: IMC trace-mode support Anju T Sudhakar
2019-04-16 10:07   ` Anju T Sudhakar
2019-04-16  9:48 Anju T Sudhakar
2019-04-16  9:48 ` [PATCH v4 3/5] powerpc/perf: Add privileged access check for thread_imc Anju T Sudhakar

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=20190415101204.15125-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).