All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/5] perf file align features, avoid UB
@ 2024-12-16 23:24 Ian Rogers
  2024-12-16 23:24 ` [PATCH v3 1/5] perf cpumap: If the die_id is missing use socket/physical_package_id Ian Rogers
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Ian Rogers @ 2024-12-16 23:24 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, Kan Liang, Sun Haiyong, Yanteng Si,
	linux-perf-users, linux-kernel

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/20241212080530.1329601-1-irogers@google.com/

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(-)

-- 
2.47.1.613.gc27f4b7a9f-goog


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2024-12-20 17:45 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-16 23:24 [PATCH v3 0/5] perf file align features, avoid UB Ian Rogers
2024-12-16 23:24 ` [PATCH v3 1/5] perf cpumap: If the die_id is missing use socket/physical_package_id Ian Rogers
2024-12-18 12:04   ` James Clark
2024-12-18 17:42     ` Ian Rogers
2024-12-19  5:32       ` Namhyung Kim
2024-12-19 17:20         ` Ian Rogers
2024-12-19 21:53           ` Namhyung Kim
2024-12-20 10:28             ` James Clark
2024-12-20 17:45               ` Ian Rogers
2024-12-16 23:24 ` [PATCH v3 2/5] perf header: Write out even empty die_cpus_list Ian Rogers
2024-12-16 23:24 ` [PATCH v3 3/5] perf synthetic-events: Ensure features are aligned Ian Rogers
2024-12-19  1:08   ` Namhyung Kim
2024-12-19  1:29     ` Ian Rogers
2024-12-19  5:29       ` Namhyung Kim
2024-12-16 23:24 ` [PATCH v3 4/5] perf machine: Avoid UB by delaying computing branch entries Ian Rogers
2024-12-16 23:24 ` [PATCH v3 5/5] perf record: Assert synthesized events are 8-byte aligned Ian Rogers

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.