Re: [PATCH] selftests/livepatch: build test modules against the selected kernel

From: Sasha Levin

Date: Sat Oct 17 2026 - 10:39:01 EST


On Wed, Oct 14, 2026 at 08:12:26PM +0000, sashiko-bot@xxxxxxxxxx wrote:
>> +modules clean: MAKEOVERRIDES := $(filter-out O=% KBUILD_OUTPUT=%,$(MAKEOVERRIDES))
>
>[Severity: Medium]
>Will this target-specific assignment of MAKEOVERRIDES be ignored by GNU Make?
>
>GNU Make does not support target-specific assignments for special variables
>like MAKEOVERRIDES and MAKEFLAGS. As a result, the global O= and
>KBUILD_OUTPUT= overrides will still be passed to the sub-make via MAKEFLAGS.

It is not ignored. MAKEFLAGS holds a reference to $(MAKEOVERRIDES), so
the sub-make started from these recipes gets the filtered value.

I checked with make 4.4.1, running the livepatch Makefile with O= and
KBUILD_OUTPUT= on the command line and a KDIR whose Makefile prints what
it receives. Without this patch both arrive as command line variables.
With it, neither is in MAKEFLAGS, KBUILD_OUTPUT is unset, and O is only
in the environment, which the kernel Makefile ignores since it uses O
only when its origin is "command line".

>Is the call to has_kdir inside setup_config still appropriate here?
>
>When running tests via the kselftest_install workflow on a target system
>without a kernel build tree, has_kdir fails and unconditionally skips the
>tests.

This patch does not change that. setup_config has called has_kdir since
54ee3526796f ("selftests: livepatch: Avoid running the tests if kernel-devel is missing"),
and this patch only adds the livepatch availability check in front of it.

--
Thanks,
Sasha