All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Usama Arif" <usama.arif@linux.dev>, linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 1/3] perf/core: Fix perf_sample_data reuse across software events
Date: Thu, 19 Nov 2026 21:16:24 +0000	[thread overview]
Message-ID: <sashiko-outbox-224086@kernel.org> (raw)
In-Reply-To: <20261119211235.99805-2-usama.arif@linux.dev>

> do_perf_sw_event() passes one on-stack struct perf_sample_data to every
> matching event. perf_prepare_sample() fills in the fields an event
> samples, marks them in data->sample_flags and skips fields that are
> already marked, and those marks survive from one event to the next.
> 
> So a sampling event later in the list emits the sample ID, timestamp,
> pid/tid and callchain prepared for an earlier one. Its record size is
> computed from the earlier event's dynamic fields as well and can come
> out smaller than what is written, in which case the kernel writes past
> its ring-buffer reservation over the records that follow.
> 
> Two "perf record -e page-faults,context-switches -c 1 -a" sessions
> running at the same time hit this: the one started first gets the
> other's sample IDs and fails with "Bad address".
> 
> Commit 1d1bfe30dad5 ("perf/core: Fix perf_sample_data not properly
> initialized for different swevents in perf_tp_event()") fixed the same
> problem for tracepoints. Do the same here: initialize the struct for
> each matching event. While at it, drop the unused data argument of
> perf_swevent_match().
> 
> Fixes: bb447c27a467 ("perf/core: Set data->sample_flags in perf_prepare_sample()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Usama Arif <usama.arif@linux.dev>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261119211235.99805-1-usama.arif@linux.dev?part=1


  reply	other threads:[~2026-11-19 21:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 21:10 [PATCH 0/3] perf/core: Fix software event sample data, then stop zeroing it Usama Arif
2026-11-19 21:10 ` [PATCH 1/3] perf/core: Fix perf_sample_data reuse across software events Usama Arif
2026-11-19 21:16   ` sashiko-bot [this message]
2026-11-19 21:10 ` [PATCH 2/3] perf/core: Don't let BPF programs read an uninitialized sample address Usama Arif
2026-11-19 21:18   ` sashiko-bot
2026-11-19 21:10 ` [PATCH 3/3] perf/core: Don't zero perf_sample_data in do_perf_sw_event() Usama Arif
2026-11-19 21:19   ` sashiko-bot
2026-11-20  9:11   ` Peter Zijlstra
2026-11-20  9:12     ` Peter Zijlstra
2026-11-20 20:02     ` Usama Arif

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-224086@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=usama.arif@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 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.