linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luo Gengkun <luogengkun@huaweicloud.com>
To: peterz@infradead.org
Cc: mingo@redhat.com, acme@kernel.org, namhyung@kernel.org,
	mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
	jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com,
	kan.liang@linux.intel.com, tglx@linutronix.de, bp@alien8.de,
	dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com,
	will@kernel.org, paul@paul-moore.com, jmorris@namei.org,
	serge@hallyn.com, rostedt@goodmis.org, mhiramat@kernel.org,
	mathieu.desnoyers@efficios.com, stephen.smalley.work@gmail.com,
	omosnace@redhat.com, linux-perf-users@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-security-module@vger.kernel.org,
	linux-trace-kernel@vger.kernel.org, selinux@vger.kernel.org,
	luogengkun@huaweicloud.com
Subject: [PATCH linux-next 2/2] perf: Return EACCESS when need perfmon capability
Date: Mon, 23 Dec 2024 07:06:50 +0000	[thread overview]
Message-ID: <20241223070650.2810747-3-luogengkun@huaweicloud.com> (raw)
In-Reply-To: <20241223070650.2810747-1-luogengkun@huaweicloud.com>

For perf_allow_kernel and perf_allow_cpu, both return EACCES when require
CAP_PERFMON or CAP_SYS_ADMIN permissions, so update perf_allow_tracepoint
to keep them the same.

Signed-off-by: Luo Gengkun <luogengkun@huaweicloud.com>
---
 include/linux/perf_event.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 5d2ec4283ebf..c1bc0d7a275b 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1685,7 +1685,7 @@ static inline int perf_allow_cpu(void)
 static inline int perf_allow_tracepoint(void)
 {
 	if (sysctl_perf_event_paranoid > -1 && !perfmon_capable())
-		return -EPERM;
+		return -EACCES;
 
 	return security_perf_event_open(PERF_SECURITY_TRACEPOINT);
 }
-- 
2.34.1


  parent reply	other threads:[~2024-12-23  6:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-23  7:06 [PATCH linux-next 0/2] Fix perf security check problem Luo Gengkun
2024-12-23  7:06 ` [PATCH linux-next 1/2] perf: Remove unnecessary parameter of security check Luo Gengkun
2025-01-05  2:45   ` Paul Moore
2025-01-07  1:52     ` Luo Gengkun
2025-02-25 21:59     ` Ingo Molnar
2025-02-26 19:13   ` [PATCH " Paul Moore
2024-12-23  7:06 ` Luo Gengkun [this message]
2025-01-06 15:59   ` [PATCH linux-next 2/2] perf: Return EACCESS when need perfmon capability James Clark
2025-01-07  1:46     ` Luo Gengkun

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=20241223070650.2810747-3-luogengkun@huaweicloud.com \
    --to=luogengkun@huaweicloud.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=irogers@google.com \
    --cc=jmorris@namei.org \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=omosnace@redhat.com \
    --cc=paul@paul-moore.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=selinux@vger.kernel.org \
    --cc=serge@hallyn.com \
    --cc=stephen.smalley.work@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    /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).