BPF List
 help / color / mirror / Atom feed
From: Wang Yibo <szwyb123@gmail.com>
To: bpf@vger.kernel.org
Cc: Andrii Nakryiko <andrii@kernel.org>,
	Alexei Starovoitov <alexei.starovoitov@gmail.com>
Subject: [PATCH bpf-next 0/3] Add diagnostics for kfunc registration failures and jit subtest skips
Date: Thu, 22 Oct 2026 08:06:54 +0800	[thread overview]
Message-ID: <20261022080500.100-1-szwyb123@gmail.com> (raw)

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

             reply	other threads:[~2026-10-22  0:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22  0:06 Wang Yibo [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261022080500.100-1-szwyb123@gmail.com \
    --to=szwyb123@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox