From: James Clark <james.clark@linaro.org>
To: Luo Gengkun <luogengkun@huaweicloud.com>
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,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH linux-next 2/2] perf: Return EACCESS when need perfmon capability
Date: Mon, 6 Jan 2025 15:59:43 +0000 [thread overview]
Message-ID: <57627eec-10b5-4eb0-bfe2-f404a3492eee@linaro.org> (raw)
In-Reply-To: <20241223070650.2810747-3-luogengkun@huaweicloud.com>
On 23/12/2024 7:06 am, Luo Gengkun wrote:
> 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;
>
Is this necessary other than for consistency? If not it might be best to
leave it inconsistent even if it's wrong. I see quite a few "if EPERM do
this..." type things in Perf, so changing this would break error
messages being shown to users.
If anything, EPERM seems more correct because EACCESS is more about file
access.
Thanks
James
next prev parent reply other threads:[~2025-01-06 15:59 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 ` [PATCH linux-next 2/2] perf: Return EACCESS when need perfmon capability Luo Gengkun
2025-01-06 15:59 ` James Clark [this message]
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=57627eec-10b5-4eb0-bfe2-f404a3492eee@linaro.org \
--to=james.clark@linaro.org \
--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=luogengkun@huaweicloud.com \
--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
all inboxes | Powered by JetHome®