BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/3] Add diagnostics for kfunc registration failures and jit subtest skips
@ 2026-10-22  0:06 Wang Yibo
  2026-10-22  0:07 ` [PATCH bpf-next 1/3] bpf: report kfunc sets that fail BTF sanity check Wang Yibo
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Wang Yibo @ 2026-10-22  0:06 UTC (permalink / raw)
  To: bpf; +Cc: Andrii Nakryiko, Alexei Starovoitov

While testing the unwind_goto series on arm64 I ran into two places
where a failure is reported without any information about what went
wrong, and each took a while to track down. These three patches add
the diagnostics that would have saved that time.

Patch 1: when a kfunc in a registered set has no proper FUNC entry in
the BTF of the registering object, register_btf_kfunc_id_set()
returns -EINVAL and nothing is printed. With bpf_testmod built by
pahole 1.30 the module fails to load with -22 and dmesg stays empty;
the only hint is a resolve_btfids warning buried in the build log.
Log the offending id, the owner of the BTF and the error code.

Patch 2: bpf_testmod_init() chains twelve registrations with
"ret = ret ?:", so when one of them fails there is no way to tell
which call it was without instrumenting the module. Print the
failing expression.

Patch 3: when test_progs is built without LLVM development libraries,
every subtest that checks jited output skips with a message that is
only visible under -v and does not say what to do about it. Point at
the fix, and add a missing newline in the verbose-only fallback
message.

One observation from building both architectures: with
CONFIG_WERROR=y (the x86_64 defconfig default) resolve_btfids runs
with --fatal_warnings, so the stale-pahole case fails the module
build outright instead of producing a module that fails at load
time. Patches 1 and 2 only help the WERROR=n path, which is what we
run in our arm64 CI.

Verified on arm64 (KVM guest) and x86_64 (TCG guest) against
bpf-next master b71326388a: with the patched kernel a
pahole-1.30-built bpf_testmod still fails to load, but dmesg now
says which kfunc and which registration failed; with pahole 1.32 it
loads cleanly, and the unwind selftests still pass 42/42.


Wang Yibo (3):
  bpf: report kfunc sets that fail BTF sanity check
  selftests/bpf: name the failing registration in bpf_testmod_init
  selftests/bpf: say how to fix the missing LLVM skip for jited checks

 kernel/bpf/btf.c                              |  6 ++-
 .../selftests/bpf/jit_disasm_helpers.c        |  2 +-
 .../selftests/bpf/test_kmods/bpf_testmod.c    | 41 +++++++++++--------
 tools/testing/selftests/bpf/test_loader.c     |  2 +-
 4 files changed, 32 insertions(+), 19 deletions(-)

-- 
2.51.0

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

end of thread, other threads:[~2026-10-25  1:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-22  0:06 [PATCH bpf-next 0/3] Add diagnostics for kfunc registration failures and jit subtest skips Wang Yibo
2026-10-22  0:07 ` [PATCH bpf-next 1/3] bpf: report kfunc sets that fail BTF sanity check Wang Yibo
2026-10-22  0:28   ` bot+bpf-ci
2026-10-22  0:07 ` [PATCH bpf-next 2/3] selftests/bpf: name the failing registration in bpf_testmod_init Wang Yibo
2026-10-25  1:24   ` Alexei Starovoitov
2026-10-22  0:07 ` [PATCH bpf-next 3/3] selftests/bpf: say how to fix the missing LLVM skip for jited checks Wang Yibo
2026-10-22  0:28   ` bot+bpf-ci

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox