]> git.ipfire.org Git - thirdparty/linux.git/commit
perf header: Sanity check HEADER_MEM_TOPOLOGY
authorArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 10 Apr 2026 22:08:58 +0000 (19:08 -0300)
committerNamhyung Kim <namhyung@kernel.org>
Tue, 14 Apr 2026 06:21:53 +0000 (23:21 -0700)
commita881fc56038a7baa5cb5074cdd52315d9ad9ee63
tree632640c314da244012ed679fddd706407f34eea2
parent4ba223016b0be7ec11aad63f480cd251cecad594
perf header: Sanity check HEADER_MEM_TOPOLOGY

Add validation to process_mem_topology() to harden against malformed
perf.data files:

- Upper bound check on nr_nodes (reuses MAX_NUMA_NODES, 4096)
- Minimum section size check before allocating

This is particularly important here since nr is u64, making unbounded
values especially dangerous.

Cc: Jiri Olsa <jolsa@kernel.org>
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>
tools/perf/util/header.c