From: Peter Zijlstra <peterz@infradead.org>
To: Timo Beckers <timo@incline.eu>
Cc: Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
"open list:PERFORMANCE EVENTS SUBSYSTEM"
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] perf core: apply calculated padding to PERF_SAMPLE_RAW output
Date: Tue, 14 Mar 2023 20:27:40 +0100 [thread overview]
Message-ID: <20230314192740.GQ2017917@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20200519132616.794171-1-timo@incline.eu>
On Tue, May 19, 2020 at 03:26:16PM +0200, Timo Beckers wrote:
> Zero the amount of padding bytes determined in perf_prepare_sample().
> This prevents garbage being read from the ring buffer after it has wrapped
> the page boundary at least once.
But it's user garbage, right? And they should be unconsumed anyway.
> Signed-off-by: Timo Beckers <timo@incline.eu>
> ---
> kernel/events/core.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 80cf996a7f19..d4e0b003ece0 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -6807,8 +6807,16 @@ void perf_output_sample(struct perf_output_handle *handle,
> break;
> frag = frag->next;
> } while (1);
> - if (frag->pad)
> - __output_skip(handle, NULL, frag->pad);
> + /*
> + * The padding value is determined in
> + * perf_prepare_sample() and is not
> + * expected to exceed u64.
> + */
> + if (frag->pad) {
> + u64 zero = 0;
> +
> + __output_copy(handle, &zero, frag->pad);
> + }
> } else {
> struct {
> u32 size;
> --
> 2.26.2
>
next prev parent reply other threads:[~2023-03-14 19:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 13:26 Timo Beckers
2023-03-14 19:27 ` Peter Zijlstra [this message]
2023-03-16 16:32 ` Timo Beckers
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=20230314192740.GQ2017917@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=timo@incline.eu \
/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®