Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ian Rogers" <irogers@google.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v1] perf evsel: Add missing bounds checks in __evsel__parse_sample()
Date: Tue, 01 Dec 2026 07:21:56 +0000	[thread overview]
Message-ID: <sashiko-outbox-242760@kernel.org> (raw)
In-Reply-To: <20261201071435.824674-1-irogers@google.com>

> perf_event__check_size() only validates event->header.size against
> evsel->sample_size, which covers the fixed-size PERF_SAMPLE_MASK fields
> up to PERF_SAMPLE_PERIOD (plus PERF_SAMPLE_IDENTIFIER). Every optional
> field parsed after that point in __evsel__parse_sample() must validate
> remaining payload bounds before dereferencing array.
> 
> The PERF_SAMPLE_PHYS_ADDR, PERF_SAMPLE_CGROUP,
> PERF_SAMPLE_DATA_PAGE_SIZE, and PERF_SAMPLE_CODE_PAGE_SIZE branches
> dereference *array without calling OVERFLOW_CHECK_u64(array), allowing
> a truncated or malformed PERF_RECORD_SAMPLE event to read past the end
> of the event buffer.
> 
> Add the missing OVERFLOW_CHECK_u64(array) checks to all four fields and
> add truncated-sample regression tests for them in sample-parsing.c.
> 
> Fixes: 3b0a5daa0610 ("perf tools: Support new sample type for physical address")
> Fixes: ba78c1c5461c ("perf tools: Basic support for CGROUP event")
> Fixes: 542b88fd1276 ("perf record: Support new sample type for data page size")
> Fixes: c1de7f3d84ca ("perf record: Add support for PERF_SAMPLE_CODE_PAGE_SIZE")
> Signed-off-by: Ian Rogers <irogers@google.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201071435.824674-1-irogers@google.com?part=1

      reply	other threads:[~2026-12-01  7:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  7:14 [PATCH v1] perf evsel: Add missing bounds checks in __evsel__parse_sample() Ian Rogers
2026-12-01  7:21 ` sashiko-bot [this message]

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=sashiko-outbox-242760@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=irogers@google.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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