Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH] selftests: livepatch: unset sub_make_done in case top level Makefile be overwritten
@ 2026-05-25  8:37 Zelin Deng
  2026-06-19 14:42 ` Miroslav Benes
  0 siblings, 1 reply; 10+ messages in thread
From: Zelin Deng @ 2026-05-25  8:37 UTC (permalink / raw)
  To: mbenes, shuah; +Cc: linux-kselftest, Zelin Deng

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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-07-02  8:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-25  8:37 [PATCH] selftests: livepatch: unset sub_make_done in case top level Makefile be overwritten Zelin Deng
2026-06-19 14:42 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox