dynup/kpatch

kpatch-build: .rela.return_sites not selected for inclusion on 5.18.12-rc1+ kernels

dobsonj opened this issue · 2 comments

Using fedora 36 / kernel-5.18.11-200.fc36.x86_64 with kpatch built from the following commit:

commit dc7e5cb03de7ba1d7781ab826bdb7107e3557f56 (HEAD -> master, origin/master, origin/HEAD)
Merge: d1423a3 48d997f
Author: Joe Lawrence <joe.lawrence@redhat.com>
Date:   Wed Jun 29 09:55:53 2022 -0400

    Merge pull request #1203 from sumanthkorikkar/s390x-kpatch-support
    
    S390x kpatch support

I tried a simple example similar to the quick start guide but it fails with .rela.return_sites not selected for inclusion.

[vagrant@fedora36 linux-5.18.11-200.fc36.x86_64]$ cat meminfo-string.diff
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index 6fa761c9..c1a3ab6c 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -55,6 +55,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
        sreclaimable = global_node_page_state_pages(NR_SLAB_RECLAIMABLE_B);
        sunreclaim = global_node_page_state_pages(NR_SLAB_UNRECLAIMABLE_B);

+       available = 1337;
        show_val_kb(m, "MemTotal:       ", i.totalram);
        show_val_kb(m, "MemFree:        ", i.freeram);
        show_val_kb(m, "MemAvailable:   ", available);
[vagrant@fedora36 linux-5.18.11-200.fc36.x86_64]$ SRCRPM=~/kernel-5.18.11-200.fc36.src.rpm kpatch-build meminfo-string.diff
Using cache at /home/vagrant/.kpatch/src
Testing patch file(s)
Reading special section data
Building original source
Building patched source
Extracting new and modified ELF sections
ERROR: meminfo.o: 1 unsupported section change(s)
meminfo.o: changed function: meminfo_proc_show
meminfo.o: changed section .rela.return_sites not selected for inclusion
/usr/local/libexec/kpatch/create-diff-object: unreconcilable difference
ERROR: 1 error(s) encountered. Check /home/vagrant/.kpatch/build.log for more details.

The return_sites section was introduced here in the fedora-5.18 branch:

https://gitlab.com/cki-project/kernel-ark/-/commit/d708480894fa6ae9914a905a68dae62a54dc766c
https://gitlab.com/cki-project/kernel-ark/-/commit/d848ebf0fea9eafccde938d87b17cfc785ad7e73

And those patches are proposed to be included in 5.18.12-rc1 upstream too:

https://lore.kernel.org/lkml/20220713222145.GA8@a5decbf3d67e/T/#m4243915c670080d343e70c239331d1708c063fda
https://lore.kernel.org/lkml/20220713222145.GA8@a5decbf3d67e/T/#m88e12fd1e64b2c03f83a635c22e117af9ada52fa

In comparison, that same patch and kpatch-build binary succeeds on fedora 35 / kernel-5.14.10-300.fc35.x86_64.

Thanks for the report, @dobsonj

@jpoimboe , since you reviewed those kernel patches from PeterZ.. what do you think? Can kpatch-build treat .return_sites like .retpoline_sites?

Thanks for the report, @dobsonj

@jpoimboe , since you reviewed those kernel patches from PeterZ.. what do you think? Can kpatch-build treat .return_sites like .retpoline_sites?

I tried this approach (treating it like .retpoline_sites) and it worked for me, so I opened PR #1281