From: sashiko-bot@kernel.org
To: "Ricardo B. Marlière" <rbm@suse.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v5 02/11] selftests/bpf: Fix test_kmods KDIR to honor O= and distro kernels
Date: Wed, 15 Apr 2026 21:18:28 +0000 [thread overview]
Message-ID: <20260415211828.BFAFFC19424@smtp.kernel.org> (raw)
In-Reply-To: <20260415-selftests-bpf_misconfig-v5-2-03d0a52a898a@suse.com>
Sashiko AI review found 2 potential issue(s):
- [High] Skipping module compilation in permissive mode fatally breaks `rsync` during out-of-tree builds.
- [Medium] Silently omitting the kernel modules converts a build skip into unconditional runtime test suite failures.
--
commit 7696fe9d292ef9e4b288adf6be9f441665f1447a
Author: Ricardo B. Marlière <rbm@suse.com>
selftests/bpf: Fix test_kmods KDIR to honor O= and distro kernels
This commit updates test_kmods/Makefile to respect out-of-tree builds using
O= and KBUILD_OUTPUT. It also introduces a permissive mode that silently
skips building modules if the kernel directory is missing.
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -296,7 +296,7 @@ $(addprefix test_kmods/,$(subst .ko,%ko,$(TEST_KMODS))): $(VMLINUX_BTF) $(RESOLV
>
> $(TEST_KMOD_TARGETS): $(addprefix test_kmods/,$(TEST_KMODS))
> $(call msg,MOD,,$@)
> - $(Q)cp test_kmods/$(@F) $@
> + $(Q)$(if $(PERMISSIVE),if [ -f test_kmods/$(@F) ]; then )cp test_kmods/$(@F) $@$(if $(PERMISSIVE),; fi)
Does skipping the cp command leave the target file missing from
TEST_KMOD_TARGETS, which is subsequently included in TRUNNER_EXTRA_FILES?
During an out-of-tree build where O= is set, the rule
$(TRUNNER_BINARY)-extras runs rsync -aq $$^ $(TRUNNER_OUTPUT)/. Since $$^
evaluates to the prerequisites, it passes the missing .ko file path directly
to rsync.
Because the file was never created, does this cause rsync to fail fatally
with a No such file or directory error and abort the build?
Note that while the later patch selftests/bpf: Tolerate missing files
during install adds --ignore-missing-args to fix make install, it does not
modify the $(TRUNNER_BINARY)-extras target, leaving out-of-tree make all
broken.
> diff --git a/tools/testing/selftests/bpf/test_kmods/Makefile b/tools/testing/selftests/bpf/test_kmods/Makefile
> --- a/tools/testing/selftests/bpf/test_kmods/Makefile
> +++ b/tools/testing/selftests/bpf/test_kmods/Makefile
[ ... ]
> @@ -14,8 +16,24 @@ $(foreach m,$(MODULES),$(eval obj-m += $(m:.ko=.o)))
>
> CFLAGS_bpf_testmod.o = -I$(src)
>
> +# When BPF_STRICT_BUILD != 0, a missing KDIR is fatal (the default).
> +# When permissive, skip silently.
> +PERMISSIVE := $(filter 0,$(BPF_STRICT_BUILD))
> +
> all:
> - $(Q)$(MAKE) -C $(KDIR) M=$(TEST_KMOD_DIR) modules
> +ifeq ($(PERMISSIVE),)
> + $(Q)$(MAKE) -C $(KDIR) $(if $(KMOD_O),O=$(KMOD_O),KBUILD_OUTPUT=) \
> + M=$(TEST_KMOD_DIR) modules
> +else ifneq ("$(wildcard $(KDIR))", "")
> + $(Q)$(MAKE) -C $(KDIR) $(if $(KMOD_O),O=$(KMOD_O),KBUILD_OUTPUT=) \
> + M=$(TEST_KMOD_DIR) modules
> +endif
If permissive mode silently skips module compilation, does this convert a
build skip into unconditional runtime test suite failures?
While test_progs.c attempts to gracefully skip tests by checking
env.has_testmod, other runners and tests fail unconditionally.
For example, test_verifier.c explicitly calls load_bpf_testmod() and
immediately returns EXIT_FAILURE if it fails, aborting the entire
verification test suite.
Similarly, tests like bpf_mod_race.c contain strict assertions
(ASSERT_OK(load_bpf_testmod(false), ...)) in their recovery paths that fail
when the module is missing.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260415-selftests-bpf_misconfig-v5-0-03d0a52a898a@suse.com?part=2
next prev parent reply other threads:[~2026-04-15 21:18 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-15 20:59 [PATCH bpf-next v5 00/11] selftests/bpf: Tolerate partial builds across kernel configs Ricardo B. Marlière
2026-04-15 20:59 ` [PATCH bpf-next v5 01/11] selftests/bpf: Add BPF_STRICT_BUILD toggle Ricardo B. Marlière
2026-04-15 20:59 ` [PATCH bpf-next v5 02/11] selftests/bpf: Fix test_kmods KDIR to honor O= and distro kernels Ricardo B. Marlière
2026-04-15 21:18 ` sashiko-bot [this message]
2026-04-15 21:43 ` bot+bpf-ci
2026-04-15 20:59 ` [PATCH bpf-next v5 03/11] selftests/bpf: Tolerate BPF and skeleton generation failures Ricardo B. Marlière
2026-04-15 21:15 ` sashiko-bot
2026-04-15 21:43 ` bot+bpf-ci
2026-04-15 20:59 ` [PATCH bpf-next v5 04/11] selftests/bpf: Avoid rebuilds when running emit_tests Ricardo B. Marlière
2026-04-15 20:59 ` [PATCH bpf-next v5 05/11] selftests/bpf: Make skeleton headers order-only prerequisites of .test.d Ricardo B. Marlière
2026-04-15 20:59 ` [PATCH bpf-next v5 06/11] selftests/bpf: Tolerate test file compilation failures Ricardo B. Marlière
2026-04-15 20:59 ` [PATCH bpf-next v5 07/11] selftests/bpf: Allow test_progs to link with a partial object set Ricardo B. Marlière
2026-04-15 21:19 ` sashiko-bot
2026-04-15 21:54 ` bot+bpf-ci
2026-04-15 20:59 ` [PATCH bpf-next v5 08/11] selftests/bpf: Tolerate benchmark build failures Ricardo B. Marlière
2026-04-15 20:59 ` [PATCH bpf-next v5 09/11] selftests/bpf: Provide weak definitions for cross-test functions Ricardo B. Marlière
2026-04-15 20:59 ` [PATCH bpf-next v5 10/11] selftests/bpf: Skip tests whose objects were not built Ricardo B. Marlière
2026-04-15 21:11 ` sashiko-bot
2026-04-15 21:43 ` bot+bpf-ci
2026-04-15 20:59 ` [PATCH bpf-next v5 11/11] selftests/bpf: Tolerate missing files during install Ricardo B. Marlière
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=20260415211828.BFAFFC19424@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=rbm@suse.com \
--cc=sashiko@lists.linux.dev \
/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