Skip to content

Sanity check perf.data headers

Arnaldo Carvalho de Melo linux-perf-users lkml 2 versions Applied

Status from this message: Applied to perf-tools-next, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest13 patches 2 repliesApplied
  2. v113 patches 1 replySuperseded

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/13perf header: Validate nr_domains when reading HEADER_CPU_DOMAIN_INFOtools/perf/util/header.c+6 -00 replies
2/13perf header: Bump up the max number of command line args allowedtools/perf/util/header.c+5 -20 replies
3/13perf header: Sanity check HEADER_NRCPUS and HEADER_CPU_DOMAIN_INFOtools/perf/util/header.c+44 -10 replies
4/13perf header: Sanity check HEADER_CPU_TOPOLOGYtools/perf/util/header.c+25 -20 replies
5/13perf header: Sanity check HEADER_NUMA_TOPOLOGYtools/perf/util/header.c+13 -00 replies
6/13perf header: Sanity check HEADER_MEM_TOPOLOGYtools/perf/util/header.c+12 -00 replies
7/13perf header: Sanity check HEADER_PMU_MAPPINGStools/perf/util/header.c+13 -00 replies
8/13perf header: Sanity check HEADER_GROUP_DESCtools/perf/util/header.c+15 -10 replies
9/13perf header: Sanity check HEADER_CACHEtools/perf/util/header.c+13 -00 replies
10/13perf header: Sanity check HEADER_HYBRID_TOPOLOGYtools/perf/util/header.c+12 -00 replies
11/13perf header: Sanity check HEADER_PMU_CAPStools/perf/util/header.c+19 -00 replies
12/13perf header: Sanity check HEADER_BPF_PROG_INFOtools/perf/util/header.c+20 -00 replies
13/13perf header: Add sanity checks to HEADER_BPF_BTF processingtools/perf/util/header.c+17 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCHES perf-tools-next v2 00/13] Sanity check perf.data headers

Hi,

Sashiko recently mentioned the lack of sanity checking headers
in perf.data files, that with a fuzzy or maliciously crafted file could make processing a perf.data file cause deleterious results.

Add sanity checks and some arbitrarily generous upper limits to
headers, if some are found to be questionable, lets tweak them in upcoming versions of this patchset.

As registered in the Assisted-by tags in the patches, this was
done using Claude code to speed up development, hopefully no hallucinations are present.

I'm also trying to get some of these checks into review-prompts
skills, some of which were already merged, for instance:

https://github.com/masoncl/review-prompts/commit/2bb2159893ea926e120105416e95629b9ef1508c

- Arnaldo

v2: Addressed some Sashiko comments for v1, some are valid but not introduced by this patchset and will be addressed in a follow up series.

Arnaldo Carvalho de Melo (13):
perf header: Validate nr_domains when reading HEADER_CPU_DOMAIN_INFO perf header: Bump up the max number of command line args allowed perf header: Sanity check HEADER_NRCPUS and HEADER_CPU_DOMAIN_INFO perf header: Sanity check HEADER_CPU_TOPOLOGY
perf header: Sanity check HEADER_NUMA_TOPOLOGY
perf header: Sanity check HEADER_MEM_TOPOLOGY
perf header: Sanity check HEADER_PMU_MAPPINGS
perf header: Sanity check HEADER_GROUP_DESC
perf header: Sanity check HEADER_CACHE
perf header: Sanity check HEADER_HYBRID_TOPOLOGY
perf header: Sanity check HEADER_PMU_CAPS
perf header: Sanity check HEADER_BPF_PROG_INFO
perf header: Add sanity checks to HEADER_BPF_BTF processing

 tools/perf/util/header.c | 220 +++++++++++++++++++++++++++++++++++++--
 1 file changed, 214 insertions(+), 6 deletions(-)
Signature · 1 line
2.53.0