Some ppc64le cleanups and fixes#757
Conversation
|
@jpoimboe Thanks for working on it. I gave it a spin on my vm with |
|
@kamalesh-babulal Thanks for testing! I just coded up a GCC plugin which converts local calls to global (basically inserting nops after the local calls), based on our upstream mailing list discussions. I did some basic testing with it, but I haven't had a chance to test it with kpatch yet because I don't have access to any POWER HW at the moment. If you want to try it out, I've added it as a commit to this pull request. Otherwise I should hopefully be able to get ahold of some HW soon. |
is_localentry_sym() isn't quite the right name, because it also checks for the 8-byte gap introduced by GCC 6, and also checks that the function is otherwise at the beginning of the section. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
The STT_FUNC and SHN_UNDEF checks aren't needed because they're already implied by the localentry check. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
On ppc64le, adding a printk to total_mapping_size() caused it to change from non-localentry to localentry, presumably because it was no longer a leaf function. With GCC 6, a localentry function is offset by 8 in the section, so different st_values are ok. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
…ng assumption kpatch_replace_sections_syms() assumes that all bundled symbols start at section offset zero. With ppc64le and GCC 6+, that assumption is no longer accurate. When replacing a rela symbol section with its corresponding symbol, adjust the addend as necessary. Also, with this fix in place, the workaround in create_klp_relasecs_and_syms() can be removed. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
kpatch_relocation's 'dest' addend and 'offset' fields are redundant. In fact, the 'offset' field isn't always accurate because it doesn't have a relocation, so its value doesn't adjust when multiple .o files are combined. Just use the 'dest' addend instead. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
When creating .kpatch.relocations, there's no reason to convert the relocation destinations to symbols. In fact, it's actively harmful because it makes it harder for create-klp-module to deal with the GCC 6+ 8-byte localentry gap. This also fixes a regression which was introduced in 5888f31, which broke ppc64le relocations. Fixes dynup#754. Fixes: 5888f31 ("create-klp-module: support unbundled symbols") Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
fd3c00f to
f1df17b
Compare
|
@jpoimboe Thank you for the GCC plugin. I tried running on the latest kernel and the build fails Looks like the label is generated twice no-op are inserted after the branch (local functions) |
f1df17b to
04207bd
Compare
|
Oops, I found where it was also changing the label. It should be fixed now. I've got a POWER8 box today, should be able to give it some more testing. |
|
|
Awesome! |
It one of the special case, where |
|
Ok, I'll take a look at it. I may need to tweak the plugin, it might not be finding all the branches yet. |
…l calls This is in response to an upstream discussion for the following patch: https://lkml.kernel.org/r/1508217523-18885-1-git-send-email-kamalesh@linux.vnet.ibm.com This should hopefully make it a lot easier for the ppc64le kernel module code to support klp relocations. The gcc-common.h and gcc-generate-rtl-pass.h header files are copied from the upstream Linux source tree. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
04207bd to
63a94b8
Compare
|
Found the bug already :-) (Untested) fix pushed. |
|
|
Weird, I'm still getting "module_64: livepatch_data_read_mostly: Expect noop after relocate, got 3c820000" with data-readonly.patch. Will keep looking... |
|
My latest error is due to the following code: It's a sibling call to net_set_todo(). Notice it's a Attempting to fix it by changing the restore_r2() check to ignore this situation. |
|
Got it to work with the following kernel patch: |
|
Also successfully patched load_elf_binary(), so #700 seems to be fixed as well. I'll send you my two kernel patches in case you want to send them together with the SHN_LIVEPATCH change after you do some more testing. |
I am able to reproduce the issue with |
Yes, this fixes #700 for
Thanks, will send it after the testing to LKML. |
|
I was able to build and livepatch around 19 modules based on testcases from I have two VM's with these modules loaded one with |
This is a followup to #754. This gets rid of the ppc64le-specific changes in create-klp-module, and fixes a regression which was introduced in #737.
This still needs a lot of testing on both x86 and ppc64le. I recommend meminfo-string.patch, as well as a trivial patch to
load_elf_binary()in fs/binfmt_elf.c, so that #700 gets tested properly. It also needs integration testing on x86.