mirror of https://github.com/dynup/kpatch
629b5acf3d
The kernel has a VERMAGIC_STRING, e.g. "6.2.0". The module loader uses that string to ensure that all loaded modules' version strings match the kernel's. If the kernel source is in a git tree, and if there are uncommitted changes, the version string will have a '+' or "-dirty" appended to it, like "6.1.0+" or "6.2.0-dirty". This dirty tree detection is done by the setlocalversion script. This affects kpatch-build in a few ways. When it builds the original kernel, in some cases there are uncommitted changes to the makefiles. When it builds the patched kernel, there are additional uncommitted changes due to the .patch file being applied. We want to avoid the VERMAGIC_STRING changing between builds. Otherwise it would cause problems: - object code which uses that string would change unnecessarily, causing a false positive change detected by create-diff-object - the linked patch module would report the wrong version, resulting in the module failing to load due to version mismatch. Up until now, the version was prevented from changing by running `setlocalversion --save-scmversion` before the build. That command hard-codes the version by saving it to a file which is then automatically read later during future invocations of the kernel build. Unfortunately that feature was removed in the 6.3 merge window with commit f6e09b07cc12 ("kbuild: do not put .scmversion into the source tarball"). So we need to come up with a new approach. Fix it by temporarily replacing the setlocalversion script with a one-liner which just echo's the original version. I think this is unfortunately the best we can do, as we really can't handle VERMAGIC_STRING changing, either during/between kernel builds or during the module link. Fixes #1335. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> |
||
---|---|---|
.. | ||
gcc-plugins | ||
insn | ||
Makefile | ||
create-diff-object.c | ||
create-klp-module.c | ||
create-kpatch-module.c | ||
kpatch-build | ||
kpatch-cc | ||
kpatch-elf.c | ||
kpatch-elf.h | ||
kpatch-intermediate.h | ||
kpatch.h | ||
list.h | ||
log.h | ||
lookup.c | ||
lookup.h |