diff options
| author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2026-06-05 11:06:30 -0300 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2026-06-05 19:17:31 -0300 |
| commit | 5fb2e6ad8c5d6b3b380f94c7456595511f3731be (patch) | |
| tree | f2afd81723e11b19872b67ab8ea2d51704732582 /tools/perf/scripts/python/stackcollapse.py | |
| parent | 65117c3da50f749f4c22eb7a7effc53453dff57f (diff) | |
perf c2c: Bounds-check CPU IDs in setup_nodes() topology loop
setup_nodes() iterates CPU maps from the perf.data topology header and
uses cpu.cpu directly as an array index into cpu2node[] (allocated with
c2c.cpus_cnt = env->nr_cpus_avail entries) and __set_bit(cpu.cpu, set)
(bitmap also sized to c2c.cpus_cnt).
A crafted perf.data with topology CPU IDs exceeding nr_cpus_avail causes
out-of-bounds heap writes into both the cpu2node array and the per-node
bitmap.
Add a bounds check to skip CPU IDs that fall outside the valid range.
Fixes: 1e181b92a2da ("perf c2c report: Add 'node' sort key")
Reported-by: sashiko-bot <sashiko-bot@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
