Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf header: Sanity check HEADER_HYBRID_TOPOLOGY

Add upper bound check on nr_nodes in process_hybrid_topology() to
harden against malformed perf.data files (reuses MAX_PMU_MAPPINGS,
4096).

Cc: Ian Rogers <irogers@google.com>
Assisted-by: Claude Code:claude-opus-4-6
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Arnaldo Carvalho de Melo and committed by
Namhyung Kim
47c68eb1 110a6617

+12
+12
tools/perf/util/header.c
··· 3450 3450 if (do_read_u32(ff, &nr)) 3451 3451 return -1; 3452 3452 3453 + if (nr > MAX_PMU_MAPPINGS) { 3454 + pr_err("Invalid HEADER_HYBRID_TOPOLOGY: nr_nodes (%u) > %u\n", 3455 + nr, MAX_PMU_MAPPINGS); 3456 + return -1; 3457 + } 3458 + 3459 + if (ff->size < sizeof(u32) + nr * 2 * sizeof(u32)) { 3460 + pr_err("Invalid HEADER_HYBRID_TOPOLOGY: section too small (%zu) for %u nodes\n", 3461 + ff->size, nr); 3462 + return -1; 3463 + } 3464 + 3453 3465 nodes = calloc(nr, sizeof(*nodes)); 3454 3466 if (!nodes) 3455 3467 return -ENOMEM;