diff options
| author | Ian Rogers <irogers@google.com> | 2026-09-28 23:58:31 -0700 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2026-09-29 20:49:53 +0200 |
| commit | 7c89ea1bd4c612eb5cc2e6c01f77ebfc21d5c95d (patch) | |
| tree | 3f26be8c4c506fa2bc54f587101cbd80bc49af21 /tools/perf/python | |
| parent | 9bb41680990c40e4561c1b4356012d8ab1aab113 (diff) | |
| download | linux-next-7c89ea1bd4c612eb5cc2e6c01f77ebfc21d5c95d.tar.gz linux-next-7c89ea1bd4c612eb5cc2e6c01f77ebfc21d5c95d.zip | |
perf evsel: Clamp sample_id size for ksymbol, bpf, and text_poke events
On kernels without the fix ("perf/core: Restore header fields in
sideband output callbacks") to restore event_id.header.size in
perf_event_ksymbol_output(), perf_event_bpf_output(), and
perf_event_text_poke_output(), concurrent perf sessions cause those
sideband records to be emitted with header.size inflated by multiple
id_header_size increments while the single id_sample is written
immediately after the event payload. Indexing backwards from
event->header.size reads uninitialized ring-buffer bytes at the end of
the record, causing evlist__event2evsel() to fail with -EFAULT.
Add evsel__event_size() to clamp the effective size used to locate the
trailing id_sample for PERF_RECORD_KSYMBOL, PERF_RECORD_BPF_EVENT, and
PERF_RECORD_TEXT_POKE to payload + id_hdr_size while leaving
event->header.size intact for advancing the ring-buffer/file stream.
Fixes: 9aa0bfa370b278a5 ("perf tools: Handle PERF_RECORD_KSYMBOL")
Fixes: 45178a928a4b7c60 ("perf tools: Handle PERF_RECORD_BPF_EVENT")
Fixes: 246eba8e9041c477 ("perf tools: Add support for PERF_RECORD_TEXT_POKE")
Link: https://lore.kernel.org/r/20260929014206.4175245-1-irogers@google.com
Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Song Liu <songliubraving@fb.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/python')
0 files changed, 0 insertions, 0 deletions
