-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.altinstructions section header details differ from .altinstructions #1194
Comments
I think this should fix it? index 523aa4157f80..bc821056aba9 100644
--- a/tools/objtool/arch/x86/decode.c
+++ b/tools/objtool/arch/x86/decode.c
@@ -684,7 +684,7 @@ static int elf_add_alternative(struct elf *elf,
sec = find_section_by_name(elf, ".altinstructions");
if (!sec) {
sec = elf_create_section(elf, ".altinstructions",
- SHF_WRITE, size, 0);
+ SHF_ALLOC, size, 0);
if (!sec) {
WARN_ELF("elf_create_section");
I'll try to submit a fix upstream tomorrow. |
Sorry I ran out of time to fully test this today (and heading out the door for PTO). I got as far as rebuilding the distro kernel and now notice that its export.o :: .altinstructions section does not have the (W)rite flag set. I can try a full test in a week or so when I get back. |
No worries, it's clearly a bug. I'll go ahead and submit the fix when I get the chance. |
Hi Josh, Sorry for the late follow up on this, on
For this, I posted a possible objtool fix: https://lore.kernel.org/lkml/20210817014958.1108400-1-joe.lawrence@redhat.com/T/#u However with that in place, we're left with a kpatch build failure:
I can see relocations for those symbols, but if they aren't exported by the kernel, shouldn't they have been converted into klp-relocations??
|
Ha. I'm thinking we can probably call this working as designed. paravirt_sched_clock() was converted from a parainstruction to a non-exported static call, so it can no longer be called by a module. i.e. you'd get the same compile error trying to build the kernel normally with that patch. So I think the patch isn't realistic, and thus it's not a use case we'd need to worry about. While it's possible to use a .klp.rela here, I don't know if it would be straightforward with the current design. To have the integration test still exercise paravirt, the call to paravirt_sched_clock() could be changed to a proper paravirt call, like __flush_tlb_local(). |
data-read-mostly.patch ---------------------- (ppc64le) Program received signal SIGSEGV, Segmentation fault. kpatch_check_relocations (kelf=0x10040490) at create-diff-object.c:2571 2571 sdata = rela->sym->sec->data; (gdb) bt (gdb) p rela->sym->sec->data Cannot access memory at address 0x160000007e This can be fixed by dynup#1211, but then we run into the next problem: dev.o: changed function: __netif_receive_skb_core.constprop.0 make -C /root/.kpatch/src M=/root/.kpatch/tmp/patch CFLAGS_MODULE='' make[1]: Entering directory '/root/.kpatch/src' LDS /root/.kpatch/tmp/patch/kpatch.lds CC [M] /root/.kpatch/tmp/patch/patch-hook.o LD [M] /root/.kpatch/tmp/patch/livepatch-data-read-mostly.o MODPOST /root/.kpatch/tmp/patch/Module.symvers ERROR: modpost: "__tracepoint_netif_receive_skb" [/root/.kpatch/tmp/patch/livepatch-data-read-mostly.ko] undefined! gcc-static-local-var-4.patch ---------------------------- (ppc64le) ERROR: aio.o: 2 function(s) can not be patched aio.o: function __do_sys_io_submit has no fentry/mcount call, unable to patch aio.o: function __do_sys_io_setup has no fentry/mcount call, unable to patch /root/kpatch/kpatch-build/create-diff-object: unreconcilable difference (Are our changed functions getting inlined into __do_sys_io_submit / __do_sys_io_setup on power?) module.patch ------------ (x86_64) ERROR: modpost: "__SCK__pv_sched_clock" [/root/.kpatch/tmp/patch/livepatch-module.ko] undefined! ERROR: modpost: "__SCT__pv_sched_clock" [/root/.kpatch/tmp/patch/livepatch-module.ko] undefined! See dynup#1194 shadow-newpid.patch ------------------- (ppc64le) ERROR: modpost: "__tracepoint_sched_process_fork" [/root/.kpatch/tmp/patch/test-shadow-newpid.ko] undefined! ERROR: modpost: "__tracepoint_sched_process_exit" [/root/.kpatch/tmp/patch/test-shadow-newpid.ko] undefined! (Same as previous?)
Kernel fixes have been merged upstream:
|
Yulia encountered problems building a modified module.patch [1] when running the integration tests for an early rhel-9.0 kernel. I added a bit of debugging to kpatch-build/create-diff-object.c, source and readelf:
The only interesting change for module.patch is in joe-lawrence@1c85c2e where I substituted a different static key.
[1] https://github.com/joe-lawrence/kpatch/tree/integration-tests-kernel-5.13.0-0.rc4.33.el9
export-objs.tar.gz
The text was updated successfully, but these errors were encountered: