Re: [PATCH] livepatch/klp-build: Fix klp-build vs CONFIG_MODULE_SRCVERSION_ALL
From: Song Liu
Date: Mon Jan 26 2026 - 19:36:44 EST
On Mon, Jan 26, 2026 at 3:56 PM Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
>
> When building a patch to a single-file kernel module with
> CONFIG_MODULE_SRCVERSION_ALL enabled, the klp-build module link fails in
> modpost:
>
> Diffing objects
> drivers/md/raid0.o: changed function: raid0_run
> Building patch module: livepatch-0001-patch-raid0_run.ko
> drivers/md/raid0.c: No such file or directory
> ...
>
> The problem here is that klp-build copied drivers/md/.raid0.o.cmd to the
> module build directory, but it didn't also copy over the input source
> file listed in the .cmd file:
>
> source_drivers/md/raid0.o := drivers/md/raid0.c
>
> So modpost dies due to the missing .c file which is needed for
> calculating checksums for CONFIG_MODULE_SRCVERSION_ALL.
>
> Instead of copying the original .cmd file, just create an empty one.
> Modpost only requires that it exists. The original object's build
> dependencies are irrelevant for the frankenobjects used by klp-build.
>
> Fixes: 24ebfcd65a87 ("livepatch/klp-build: Introduce klp-build script for generating livepatch modules")
> Reported-by: Song Liu <song@xxxxxxxxxx>
> Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
Tested-by: Song Liu <song@xxxxxxxxxx>
Thanks for the fix!