From: sashiko-bot@kernel.org
To: "Ricardo B. Marlière" <rbm@suse.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v7 02/11] selftests/bpf: Fix test_kmods KDIR to honor O= and distro kernels
Date: Thu, 16 Apr 2026 19:52:33 +0000 [thread overview]
Message-ID: <20260416195234.54D56C2BCAF@smtp.kernel.org> (raw)
In-Reply-To: <20260416-selftests-bpf_misconfig-v7-2-a078e18012e4@suse.com>
Sashiko AI review found 2 potential issue(s):
- [High] Overloading of O= incorrectly aliases the selftest output directory to the kernel build directory.
- [Medium] Relative paths passed to O= are incorrectly resolved against the sub-make's working directory.
--
commit 7a429745e6e5a3d1081ae76477bd32a034698ba8
Author: Ricardo B. Marlière <rbm@suse.com>
selftests/bpf: Fix test_kmods KDIR to honor O= and distro kernels
This commit modifies the test_kmods Makefile to respect the O= and
KBUILD_OUTPUT variables for locating the correct kernel build directory.
It falls back to /lib/modules/$(uname -r)/build when neither an explicit
build directory nor an in-tree Module.symvers is present.
> diff --git a/tools/testing/selftests/bpf/test_kmods/Makefile b/tools/testing/selftests/bpf/test_kmods/Makefile
> index 63c4d3f6a12f6..ba6f6ed6ab8c0 100644
> --- a/tools/testing/selftests/bpf/test_kmods/Makefile
> +++ b/tools/testing/selftests/bpf/test_kmods/Makefile
> @@ -1,5 +1,7 @@
> TEST_KMOD_DIR := $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
> -KDIR ?= $(abspath $(TEST_KMOD_DIR)/../../../../..)
> +SRCTREE_KDIR := $(abspath $(TEST_KMOD_DIR)/../../../../..)
> +KMOD_O := $(abspath $(or $(O),$(KBUILD_OUTPUT)))
If a user specifies a relative path like "make O=out", will this resolve
incorrectly against the sub-make's current working directory instead of the
parent directory?
Since abspath is evaluated inside the test_kmods sub-make, a relative
O=out would evaluate to .../test_kmods/out instead of .../bpf/out,
potentially breaking out-of-tree builds. Does the path need to be
resolved to an absolute path before the sub-make transition?
Additionally, when building selftests out-of-tree via
"make O=/tmp/selftests -C tools/testing/selftests", O= strictly defines the
selftests output directory.
Since O takes precedence in $(or $(O),$(KBUILD_OUTPUT)), will it shadow a
valid KBUILD_OUTPUT? This could cause kbuild to fail due to a missing
.config or Module.symvers in the selftests directory.
Could the Makefile differentiate the selftest output directory from the
kernel build directory, or verify that $(KMOD_O) actually contains a
prepared kernel build before forcing kbuild to use it?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260416-selftests-bpf_misconfig-v7-0-a078e18012e4@suse.com?part=2
next prev parent reply other threads:[~2026-04-16 19:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-16 19:30 [PATCH bpf-next v7 00/11] selftests/bpf: Tolerate partial builds across kernel configs Ricardo B. Marlière
2026-04-16 19:30 ` [PATCH bpf-next v7 01/11] selftests/bpf: Add BPF_STRICT_BUILD toggle Ricardo B. Marlière
2026-04-16 19:30 ` [PATCH bpf-next v7 02/11] selftests/bpf: Fix test_kmods KDIR to honor O= and distro kernels Ricardo B. Marlière
2026-04-16 19:52 ` sashiko-bot [this message]
2026-04-16 19:30 ` [PATCH bpf-next v7 03/11] selftests/bpf: Tolerate BPF and skeleton generation failures Ricardo B. Marlière
2026-04-16 19:30 ` [PATCH bpf-next v7 04/11] selftests/bpf: Avoid rebuilds when running emit_tests Ricardo B. Marlière
2026-04-16 19:30 ` [PATCH bpf-next v7 05/11] selftests/bpf: Make skeleton headers order-only prerequisites of .test.d Ricardo B. Marlière
2026-04-16 19:30 ` [PATCH bpf-next v7 06/11] selftests/bpf: Tolerate test file compilation failures Ricardo B. Marlière
2026-04-16 19:55 ` sashiko-bot
2026-04-16 19:30 ` [PATCH bpf-next v7 07/11] selftests/bpf: Skip tests whose objects were not built Ricardo B. Marlière
2026-04-16 19:30 ` [PATCH bpf-next v7 08/11] selftests/bpf: Allow test_progs to link with a partial object set Ricardo B. Marlière
2026-04-16 20:05 ` sashiko-bot
2026-04-16 19:30 ` [PATCH bpf-next v7 09/11] selftests/bpf: Tolerate benchmark build failures Ricardo B. Marlière
2026-04-16 19:30 ` [PATCH bpf-next v7 10/11] selftests/bpf: Provide weak definitions for cross-test functions Ricardo B. Marlière
2026-04-16 19:31 ` [PATCH bpf-next v7 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=20260416195234.54D56C2BCAF@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.