Re: [PATCH] selftests: livepatch: unset sub_make_done in case top level Makefile be overwritten

Miroslav Benes <[email protected]> Fri, 19 Jun 2026 16:42:15 +0200 (CEST)
Newsgroups org.kernel.vger.live-patching,org.kernel.vger.linux-kselftest
Message-ID <[email protected]>
On Mon, 25 May 2026, Zelin Deng wrote:

> 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 <[email protected]>

Adding Marcos and KLP ML.

I cannot reproduce and I do not understand it much from the changelog (I 
am by far not a Kbuild expert). Could you share the exact steps to 
reproduce please? If I just run 'make kselftest-all' in the top level, it 
passes and livepatch test_modules are not even touched.

Miroslav