mbox series

[bpf-next,v2,0/5] bpf: Fix a couple of test failures with LTO kernel

Message ID 20240321200058.2218328-1-yonghong.song@linux.dev (mailing list archive)
Headers show
Series bpf: Fix a couple of test failures with LTO kernel | expand

Message

Yonghong Song March 21, 2024, 8 p.m. UTC
With a LTO kernel built with clang, with one of earlier version of kernel,
I encountered two test failures, ksyms and kprobe_multi_bench_attach/kernel.
Now with latest bpf-next, only kprobe_multi_bench_attach/kernel failed.
But it is possible in the future ksyms selftest may fail again.

Both test failures are due to static variable/function renaming
due to cross-file inlining. For Ksyms failure, the solution is
to strip .llvm.<hash> suffixes for symbols in /proc/kallsyms before
comparing against the ksym in bpf program.
For kprobe_multi_bench_attach/kernel failure, the solution is
to either provide names in /proc/kallsyms to the kernel or
ignore those names who have .llvm.<hash> suffix since the kernel
sym name comparison is against /proc/kallsyms.

Please see each individual patches for details.

Yonghong Song (5):
  selftests/bpf: Replace CHECK with ASSERT macros for ksyms test
  libbpf: Mark libbpf_kallsyms_parse static function
  libbpf: Handle <orig_name>.llvm.<hash> symbol properly
  selftests/bpf: Fix kprobe_multi_bench_attach test failure with LTO
    kernel
  selftests/bpf: Add a selftest with available_filter_functions_addrs

 tools/lib/bpf/libbpf.c                        |  66 +++++++-
 tools/lib/bpf/libbpf_internal.h               |   2 -
 .../bpf/prog_tests/kprobe_multi_test.c        | 151 ++++++++++++++++++
 .../testing/selftests/bpf/prog_tests/ksyms.c  |  30 ++--
 4 files changed, 224 insertions(+), 25 deletions(-)