[PATCH v2 0/4] perf file align features, avoid UB

Ian Rogers posted 4 patches 1 year ago
There is a newer version of this series
tools/perf/builtin-record.c        |  5 ++++-
tools/perf/util/header.c           | 10 ++++------
tools/perf/util/machine.c          |  2 +-
tools/perf/util/synthetic-events.c |  2 ++
4 files changed, 11 insertions(+), 8 deletions(-)
[PATCH v2 0/4] perf file align features, avoid UB
Posted by Ian Rogers 1 year ago
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. Avoid UB also in machine where a NULL
may be incremented.

v2: Fix CPU topology as described in replies to v1.
v1: https://lore.kernel.org/lkml/20241212080530.1329601-1-irogers@google.com/

Ian Rogers (4):
  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/header.c           | 10 ++++------
 tools/perf/util/machine.c          |  2 +-
 tools/perf/util/synthetic-events.c |  2 ++
 4 files changed, 11 insertions(+), 8 deletions(-)

-- 
2.47.1.613.gc27f4b7a9f-goog