All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zelin Deng <zelin.deng@linux.alibaba.com>
To: mbenes@suse.cz, shuah@kernel.org
Cc: linux-kselftest@vger.kernel.org,
	Zelin Deng <zelin.deng@linux.alibaba.com>
Subject: [PATCH] selftests: livepatch: unset sub_make_done in case top level Makefile be overwritten
Date: Mon, 25 May 2026 16:37:21 +0800	[thread overview]
Message-ID: <20260525083721.27857-1-zelin.deng@linux.alibaba.com> (raw)

After I did: make kselftest-all in top level of kernel source tree, top
level Makefile was overwritten by auto generated contents by
filechk_makefile:
[root@emr: /home/shiyu.dzl/linux-next]$ cat Makefile
export KBUILD_OUTPUT = .
export KBUILD_EXTMOD = /home/shiyu.dzl/linux-next
export KBUILD_EXTMOD_OUTPUT = /home/shiyu.dzl/linux-next
include /home/shiyu.dzl/linux-next/Makefile

Top-level Makefile export sub_make_done=1, leaks into unrelated re-invocations
of the top-level Makefile when recursive descent through selftests -
building test_module of livepatch. That causes KBUILD_EXTMOD setup to be
skipped, which leads to a relative/absolute path mismatch in srcroot vs
CURDIR, falsely setting building_out_of_srctree, and ultimately overwriting
the source tree's Makefile with a generated stub.

Clear sub_make_done before re-invoking the kernel Makefile.

Fixes: c4bbe83d27c2 ("livepatch: Move tests from lib/livepatch to selftests/livepatch")
Signed-off-by: Zelin Deng <zelin.deng@linux.alibaba.com>
---
 tools/testing/selftests/livepatch/test_modules/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/livepatch/test_modules/Makefile b/tools/testing/selftests/livepatch/test_modules/Makefile
index a13d398585dc..b78657089ab7 100644
--- a/tools/testing/selftests/livepatch/test_modules/Makefile
+++ b/tools/testing/selftests/livepatch/test_modules/Makefile
@@ -19,11 +19,11 @@ obj-m += test_klp_atomic_replace.o \
 # Ensure that KDIR exists, otherwise skip the compilation
 modules:
 ifneq ("$(wildcard $(KDIR))", "")
-	$(Q)$(MAKE) -C $(KDIR) modules KBUILD_EXTMOD=$(TESTMODS_DIR)
+	$(Q)unset sub_make_done && $(MAKE) -C $(KDIR) modules KBUILD_EXTMOD=$(TESTMODS_DIR)
 endif
 
 # Ensure that KDIR exists, otherwise skip the clean target
 clean:
 ifneq ("$(wildcard $(KDIR))", "")
-	$(Q)$(MAKE) -C $(KDIR) clean KBUILD_EXTMOD=$(TESTMODS_DIR)
+	$(Q)unset sub_make_done && $(MAKE) -C $(KDIR) clean KBUILD_EXTMOD=$(TESTMODS_DIR)
 endif
-- 
2.43.7


             reply	other threads:[~2026-05-25  8:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-25  8:37 Zelin Deng [this message]
2026-06-19 14:42 ` [PATCH] selftests: livepatch: unset sub_make_done in case top level Makefile be overwritten Miroslav Benes
2026-06-21 14:36   ` Zelin Deng
2026-06-30 14:32     ` Petr Mladek
2026-06-30 16:12       ` Thomas Weißschuh
2026-07-01 15:14         ` Petr Mladek
2026-07-01 15:19           ` Thomas Weißschuh
2026-07-02  2:40             ` Zelin Deng
2026-07-02  7:11               ` Thomas Weißschuh
2026-07-02  8:09                 ` Zelin Deng

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=20260525083721.27857-1-zelin.deng@linux.alibaba.com \
    --to=zelin.deng@linux.alibaba.com \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=shuah@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.