From: sashiko-bot@kernel.org
To: "Sasha Levin" <sashal@kernel.org>,
"Josh Poimboeuf" <jpoimboe@kernel.org>,
"Miroslav Benes" <mbenes@suse.cz>,
"Petr Mladek" <pmladek@suse.com>,
"Joe Lawrence" <joe.lawrence@redhat.com>
Cc: "Song Liu" <song@kernel.org>,
"Marcos Paulo de Souza" <mpdesouza@suse.com>,
"Eva Kurchatova" <eva.kurchatova@virtuozzo.com>,
"Yafang Shao" <laoar.shao@gmail.com>,
"Shuah Khan" <shuah@kernel.org>,
live-patching@vger.kernel.org
Subject: Re: [PATCH v4 3/4] selftests/livepatch: build the test modules against the kernel in O=
Date: Tue, 10 Nov 2026 16:53:01 +0000 [thread overview]
Message-ID: <sashiko-outbox-207425@kernel.org> (raw)
In-Reply-To: <20261110161050.2451750-4-sashal@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] selftests/livepatch: KDIR fallback ignores builds without
Module.symvers
--
commit 62f70537bbca33262ec62f1273becbdf534f58fc
Author: Sasha Levin <sashal@kernel.org>
selftests/livepatch: build the test modules against the kernel in O=
This commit selects KDIR from O= or KBUILD_OUTPUT (or the kernel source
tree) before falling back to the running kernel's build directory, and
strips O= and KBUILD_OUTPUT when invoking the kernel Makefile for the
livepatch test modules.
> diff --git a/tools/testing/selftests/livepatch/Makefile b/tools/testing/selftests/livepatch/Makefile
> index a080eb54a215d..97478ef90945c 100644
> --- a/tools/testing/selftests/livepatch/Makefile
> +++ b/tools/testing/selftests/livepatch/Makefile
> @@ -1,5 +1,31 @@
> # SPDX-License-Identifier: GPL-2.0
>
> +# The test modules are built against the kernel in KDIR. When KDIR is not
> +# set, use the output directory given with O= or KBUILD_OUTPUT if a kernel
> +# was built there, as with
> +# make O=/tmp/kselftest TARGETS=livepatch kselftest
> +# otherwise the kernel source tree if the kernel was built in it, as with
> +# cd tools/testing/selftests/livepatch; make
> +# and otherwise the build directory of the running kernel, which its
> +# devel files provide. A kernel was built in a directory if it has a
> +# Module.symvers.
> +ifndef KDIR
> +KBUILD_DIR := $(firstword $(O) $(KBUILD_OUTPUT))
> +ifneq ($(and $(KBUILD_DIR),$(wildcard $(KBUILD_DIR)/Module.symvers)),)
> +KDIR := $(KBUILD_DIR)
> +else ifneq ($(wildcard ../../../../Module.symvers),)
> +KDIR := ../../../..
> +else
> +KDIR := /lib/modules/$(shell uname -r)/build
> +endif
> +endif
[Severity: Medium]
Does checking only for Module.symvers cause KDIR to fall back to the host's
/lib/modules/$(uname -r)/build when the target kernel in O= or the source
tree was built with CONFIG_MODULES=n or an image-only target (which
produces vmlinux.symvers instead of Module.symvers)?
When that happens and the host has kernel headers with CONFIG_LIVEPATCH=y,
test_modules/Makefile reads the host's include/config/auto.conf and builds
the test modules against the running host kernel instead of skipping them
for the target kernel, which breaks cross-compiled builds or builds where
the in-tree test modules use newer kernel APIs than the host.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261110161050.2451750-1-sashal@kernel.org?part=3
next prev parent reply other threads:[~2026-11-10 16:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 16:10 [PATCH v4 0/4] selftests/livepatch: build and run the tests outside the running kernel Sasha Levin
2026-11-10 16:10 ` [PATCH v4 1/4] selftests/livepatch: skip the tests on kernels without livepatch Sasha Levin
2026-11-10 16:10 ` [PATCH v4 2/4] selftests/livepatch: clean the test modules without a kernel build directory Sasha Levin
2026-11-10 16:35 ` sashiko-bot
2026-11-10 16:10 ` [PATCH v4 3/4] selftests/livepatch: build the test modules against the kernel in O= Sasha Levin
2026-11-10 16:53 ` sashiko-bot [this message]
2026-11-10 16:10 ` [PATCH v4 4/4] selftests/livepatch: run the tests with prebuilt test modules Sasha Levin
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=sashiko-outbox-207425@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=eva.kurchatova@virtuozzo.com \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=laoar.shao@gmail.com \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=mpdesouza@suse.com \
--cc=pmladek@suse.com \
--cc=sashal@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=shuah@kernel.org \
--cc=song@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 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.