Skip to contentSkip to conversation

selftests/bpf: Fix a couple of test failures with LTO kernel

PATCH In review Yonghong Song 1 participant 2 messages Mar 2, 2024 BPF

lore
Share & tools
lore

Yonghong Song

author reviewer
#0 lore raw

cover selftests/bpf: Fix a couple of test failures with LTO kernel

With a LTO kernel built with clang, I encountered two test failures, ksyms and kprobe_multi_bench_attach/kernel. Both test failures are due to static variable/function renaming due to cross-file inlining. The solution is to either skip the test or filter out those renamed functions. A helper function check_lto_kernel() is introduced to identify whether the underlying kernel is built with LTO or not. Please see each individual patches for details.

Yonghong Song (4):
selftests/bpf: Replace CHECK with ASSERT macros for ksyms test selftests/bpf: Add check_lto_kernel() helper selftests/bpf: Fix possible ksyms test failure with LTO kernel selftests/bpf: Fix possible kprobe_multi_bench_attach test failure
with LTO kernel

 .../bpf/prog_tests/kprobe_multi_test.c        |  7 +++
 .../testing/selftests/bpf/prog_tests/ksyms.c  | 42 +++++++++--------
 tools/testing/selftests/bpf/testing_helpers.c | 47 +++++++++++++++++++
 tools/testing/selftests/bpf/testing_helpers.h |  1 +
 4 files changed, 78 insertions(+), 19 deletions(-)
Signature · 1 line
2.43.0
author reviewer
#1 lore raw
Quoted 15 lines · Yonghong Song

With a LTO kernel built with clang, I encountered two test failures, ksyms and kprobe_multi_bench_attach/kernel. Both test failures are due to static variable/function renaming due to cross-file inlining. The solution is to either skip the test or filter out those renamed functions. A helper function check_lto_kernel() is introduced to identify whether the underlying kernel is built with LTO or not. Please see each individual patches for details.

Yonghong Song (4):
selftests/bpf: Replace CHECK with ASSERT macros for ksyms test selftests/bpf: Add check_lto_kernel() helper selftests/bpf: Fix possible ksyms test failure with LTO kernel selftests/bpf: Fix possible kprobe_multi_bench_attach test failure
with LTO kernel

Quoted 6 lines
  .../bpf/prog_tests/kprobe_multi_test.c        |  7 +++
  .../testing/selftests/bpf/prog_tests/ksyms.c  | 42 +++++++++--------
  tools/testing/selftests/bpf/testing_helpers.c | 47 +++++++++++++++++++
  tools/testing/selftests/bpf/testing_helpers.h |  1 +
  4 files changed, 78 insertions(+), 19 deletions(-)

Please ignore this one. It is my git send script issue with Message-Id vs. Message-ID. Will post actual series soon.