[PATCH v2 0/5] Various fixes around undefined behavior

From: Ian Rogers
Date: Thu Aug 21 2025 - 12:42:13 EST


Fix various undefined behavior issues, improve tests to make them
easier to diagnose and add assertions so that problems don't recur.

v2: Add Namhyung's acked-by. Drop container_of assert that ptr !=
NULL, to simplify the series. The bsearch UB fix was picked up as
a patch by CT:
https://lore.kernel.org/r/20250303183646.327510-2-ctshao@xxxxxxxxxx
It seems this patch series fell-through the cracks as v1 was
sent/acked 9 months ago.

v1: https://lore.kernel.org/lkml/20241213210425.526512-1-irogers@xxxxxxxxxx/

Ian Rogers (5):
perf disasm: Avoid undefined behavior in incrementing NULL
perf test trace_btf_enum: Skip if permissions are insufficient
perf evsel: Avoid container_of on a NULL leader
perf test shell lock_contention: Extra debug diagnostics
libperf event: Ensure tracing data is multiple of 8 sized

tools/lib/perf/include/perf/event.h | 1 +
tools/perf/tests/shell/lock_contention.sh | 7 ++++++-
tools/perf/tests/shell/trace_btf_enum.sh | 11 +++++++++++
tools/perf/util/disasm.c | 7 +++++--
tools/perf/util/evsel.c | 2 ++
5 files changed, 25 insertions(+), 3 deletions(-)

--
2.51.0.rc1.193.gad69d77794-goog