From: Joel Fernandes <joel@joelfernandes.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Jiri Olsa <jolsa@kernel.org>, Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
LKML <linux-kernel@vger.kernel.org>,
Stephane Eranian <eranian@google.com>,
Andi Kleen <ak@linux.intel.com>, Ian Rogers <irogers@google.com>,
James Morris <jmorris@namei.org>
Subject: Re: [PATCH] perf/core: Call LSM hook after copying perf_event_attr
Date: Fri, 3 Jun 2022 15:05:15 +0000 [thread overview]
Message-ID: <YpojK0iaPofkAzd4@google.com> (raw)
In-Reply-To: <20220602224754.602074-1-namhyung@kernel.org>
On Thu, Jun 02, 2022 at 03:47:54PM -0700, Namhyung Kim wrote:
> It passes the attr struct to the security_perf_event_open() but it's
> not initialized yet.
>
> Fixes: da97e18458fb ("perf_event: Add support for LSM and SELinux checks")
> Cc: Joel Fernandes (Google) <joel@joelfernandes.org>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> kernel/events/core.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 7858bafffa9d..e035545f624f 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -12033,12 +12033,12 @@ SYSCALL_DEFINE5(perf_event_open,
> if (flags & ~PERF_FLAG_ALL)
> return -EINVAL;
>
> - /* Do we allow access to perf_event_open(2) ? */
> - err = security_perf_event_open(&attr, PERF_SECURITY_OPEN);
> + err = perf_copy_attr(attr_uptr, &attr);
> if (err)
> return err;
>
> - err = perf_copy_attr(attr_uptr, &attr);
> + /* Do we allow access to perf_event_open(2) ? */
> + err = security_perf_event_open(&attr, PERF_SECURITY_OPEN);
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
thanks,
- Joel
> if (err)
> return err;
>
> --
> 2.36.1.255.ge46751e96f-goog
>
next prev parent reply other threads:[~2022-06-03 15:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-02 22:47 [PATCH] perf/core: Call LSM hook after copying perf_event_attr Namhyung Kim
2022-06-03 15:05 ` Joel Fernandes [this message]
2022-06-24 17:30 ` Namhyung Kim
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=YpojK0iaPofkAzd4@google.com \
--to=joel@joelfernandes.org \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=eranian@google.com \
--cc=irogers@google.com \
--cc=jmorris@namei.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.