Skip to content

perf file align features, avoid UB

Ian Rogers linux-perf-users lkml 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest5 patches 10 repliesIn review
  2. v24 patches 1 replySuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5perf cpumap: If the die_id is missing use socket/physical_package_idtools/perf/util/cpumap.c+2 -17 replies
2/5perf header: Write out even empty die_cpus_listtools/perf/util/header.c+0 -30 replies
3/5perf synthetic-events: Ensure features are alignedtools/perf/util/header.c tools/perf/util/synthetic-events.c+6 -33 replies
4/5perf machine: Avoid UB by delaying computing branch entriestools/perf/util/machine.c+1 -10 replies
5/5perf record: Assert synthesized events are 8-byte alignedtools/perf/builtin-record.c+4 -10 replies

Reviews trailers per patch

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

Read the v3 thread

Cover letter [PATCH v3 0/5] perf file align features, avoid UB

Features like hostname may not be 8-byte aligned. Add padding to make the feature aligned to avoid undefined behavior (UB). Modify the writing of the CPU topology features to always write die_cpus_list even if empty, as the size could have been aligned and not allow the missing list to be detected. As die_id may be invalid (< 0) ensure it isn't for platforms like ARM. Avoid UB also in machine where a NULL may be incremented.

v3: Additional patch to avoid invalid die_ids
v2: Fix CPU topology as described in replies to v1.
v1: https://lore.kernel.org/lkml/[email protected]/

Ian Rogers (5):
perf cpumap: If the die_id is missing use socket/physical_package_id perf header: Write out even empty die_cpus_list
perf synthetic-events: Ensure features are aligned
perf machine: Avoid UB by delaying computing branch entries perf record: Assert synthesized events are 8-byte aligned

 tools/perf/builtin-record.c        |  5 ++++-
 tools/perf/util/cpumap.c           |  3 ++-
 tools/perf/util/header.c           | 10 ++++------
 tools/perf/util/machine.c          |  2 +-
 tools/perf/util/synthetic-events.c |  2 ++
 5 files changed, 13 insertions(+), 9 deletions(-)
Signature · 1 line
2.47.1.613.gc27f4b7a9f-goog