dynup / kpatch

kpatch - live kernel patching
GNU General Public License v2.0
1.49k stars 305 forks source link

kpatch-build errors for kernel v6.1.4 #1324

Closed tli16 closed 1 year ago

tli16 commented 1 year ago

Hi all, I got some errors when test the livepatch for kernel v6.1.4. I tried the kpatch-build package which was built on master branch and the kpatch-build package which was built on v0.9.7 release. Both of them failed with the patch file on v6.1.4 kernel, just having slightly different error messages:

kpatch-build of master branch(a45c17):

Using source directory at /build/linux-6.1.4
Testing patch file(s)
Reading special section data
Building original source
Building patched source
Extracting new and modified ELF sections
create-diff-object: ERROR: version.o: find_local_syms: 189: couldn't find matching version.c local symbols in vmlinux symbol table
doing "deep find" for parent object
ERROR: invalid ancestor init/version-timestamp.o for init/version-timestamp.o. Check /root/.kpatch/build.log for more details.

==========
kpatch-build of v0.9.7(4a59a54):

Using source directory at /build/linux-6.1.4
Testing patch file(s)
Reading special section data
Building original source
Building patched source
Extracting new and modified ELF sections
ERROR: invalid ancestor fs/proc/version.o for fs/proc/version.o. Check /root/.kpatch/build.log for more details.

The patch file is trivial:

diff --git a/fs/proc/version.c b/fs/proc/version.c
index 02e3c3cd4a9a..0c76ccb98b01 100644
--- a/fs/proc/version.c
+++ b/fs/proc/version.c
@@ -13,6 +13,7 @@ static int version_proc_show(struct seq_file *m, void *v)
        utsname()->sysname,
        utsname()->release,
        utsname()->version);
+   seq_printf(m, "example livepatch\n");
    return 0;
 }
joe-lawrence commented 1 year ago

Hi @tli16 : sorry for belated reply, I thought I replied the other day but now notice it's not here.

Thanks for the report, this build error should be fixed by 934b3b3c0c12be2435f8edbe484c2696dda93864 in draft PR #1322 If you want to test sooner, you can cherry pick that locally and retry building the example patch.

tli16 commented 1 year ago

@joe-lawrence Thank you! I will test that.

tli16 commented 1 year ago

Sorry for getting back late. I cherry picked https://github.com/dynup/kpatch/commit/934b3b3c0c12be2435f8edbe484c2696dda93864 to the top of v0.9.8 and the livepatch build is successful now. looking forward to seeing them merged into the codebase. Thanks!

jpoimboe commented 1 year ago

Fixed in #1322