All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Kevin Sheldrake <Kevin.Sheldrake@microsoft.com>
Cc: "bpf@vger.kernel.org" <bpf@vger.kernel.org>,
	KP Singh <kpsingh@google.com>
Subject: Re: [PATCH bpf-next v2] Update perf ring buffer to prevent corruption
Date: Thu, 5 Nov 2020 11:07:25 -0800	[thread overview]
Message-ID: <CAEf4Bza0unqU9QWBtuh_y07OGnC_HxOK_RwO+UTJ_0XhQdm1Vg@mail.gmail.com> (raw)
In-Reply-To: <VI1PR8303MB00802FE5D289E0D7BA95B7DDFBEE0@VI1PR8303MB0080.EURPRD83.prod.outlook.com>

On Thu, Nov 5, 2020 at 7:16 AM Kevin Sheldrake
<Kevin.Sheldrake@microsoft.com> wrote:
>
> Resent due to some failure at my end.  Apologies if it arrives twice.
>
> From 63e34d4106b4dd767f9bfce951f8a35f14b52072 Mon Sep 17 00:00:00 2001
> From: Kevin Sheldrake <kevin.sheldrake@microsoft.com>
> Date: Thu, 5 Nov 2020 12:18:53 +0000
> Subject: [PATCH] Update perf ring buffer to prevent corruption from
>  bpf_perf_output_event()
>
> The bpf_perf_output_event() helper takes a sample size parameter of u64, but
> the underlying perf ring buffer uses a u16 internally. This 64KB maximum size
> has to also accommodate a variable sized header. Failure to observe this
> restriction can result in corruption of the perf ring buffer as samples
> overlap.
>
> Track the sample size and return -E2BIG if too big to fit into the u16
> size parameter.
>
> Signed-off-by: Kevin Sheldrake <kevin.sheldrake@microsoft.com>
> ---

LGTM.

Acked-by: Andrii Nakryiko <andrii@kernel.org>

>  include/linux/perf_event.h |  2 +-
>  kernel/events/core.c       | 40 ++++++++++++++++++++++++++--------------
>  2 files changed, 27 insertions(+), 15 deletions(-)
>

[...]

  reply	other threads:[~2020-11-05 19:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05 15:16 [PATCH bpf-next v2] Update perf ring buffer to prevent corruption Kevin Sheldrake
2020-11-05 19:07 ` Andrii Nakryiko [this message]
2020-11-05 19:37   ` KP Singh
2020-11-06  4:19 ` Alexei Starovoitov
2020-11-09 11:29   ` Peter Zijlstra
2020-11-09 14:22     ` [EXTERNAL] " Kevin Sheldrake
2020-11-09 17:55       ` Peter Zijlstra
2020-11-09 18:22   ` Peter Zijlstra

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=CAEf4Bza0unqU9QWBtuh_y07OGnC_HxOK_RwO+UTJ_0XhQdm1Vg@mail.gmail.com \
    --to=andrii.nakryiko@gmail.com \
    --cc=Kevin.Sheldrake@microsoft.com \
    --cc=bpf@vger.kernel.org \
    --cc=kpsingh@google.com \
    /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.