-
Notifications
You must be signed in to change notification settings - Fork 0
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
STRICT RWX breaks live patching because of late relocations #375
Comments
This is now a bug: https://lore.kernel.org/linuxppc-dev/YX9UUBeudSUuJs01@redhat.com/ |
Using the poke area is working but we'll need to implement a memcpy-that-patches like x86 and s390 since patch_instruction() is too inflexible. |
More info in dynup/kpatch#1228 |
WIP tree https://github.com/ruscur/linux/commits/poke_write_klp-convert if anyone wants to take a look.
Is there anything else that would |
For 32 bits we have a proposed series, so I think you should also handle 32 bits. See https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=269339&state=* |
We need a minimal (as possible) backportable fix, so that should be 64-bit only. We can do 32-bit as a subsequent patch. |
I can make a fix way smaller (only changing the paths that I can get livepatching to touch on active modules - which thus far I think is just Happy enough to do module_32 as well, but may need help testing it. |
No worry, I can also do the 32 bits later, the only thing I'd like is that if some code is meant to be common to both PPC32 and PPC64, please put it in By the way, if we are looking for a minimal backport, do we need that |
Yes, I'll just use
|
Hi @ruscur, let me know if you need to see any more livepatch examples or tests, but see the attached module that includes a few klp-relocation types:
(This one was generated by the kpatch build tools and not the klp-convert selftests in my kernel tree.) |
I don't think putting everything through |
Ok, let see what we can get with that By the way, I don't really like the name |
Sure, not married to the name. I still don't know what the smallest viable scope is, i.e. which relocation types are impossible for kpatch to generate, or the ftrace stuff. |
Updated testing results with the [PATCH] powerpc/module_64: Fix livepatching for RO modules patch: Test1 - add to klp-convert patchset
Test2 - backport on top of rhel-9's 5.14.0-16.el9
I was initially surprised that the second test passed after posting those additional relocation types above. However, after it did successfully load, I considered that the other relocation types (
The kpatch-build code that converts relocations to klp-relocations lives in need_dynrela() ("dynarela" is kpatch parlance for "klp-relocation") and it returns false for a bunch of other ppc64-specifc relocation types at the beginning. I'm not really sure how to determine the range of relocation types that gcc may generate for various scenarios, so perhaps the minimal fix for Adding @jpoimboe and @kamalesh-babulal, who implemented most of the ppc64le kpatch-build code, in case I missed anything obvious. |
v2 minimal patch with error checking: https://lore.kernel.org/all/20211214121248.777249-1-mpe@ellerman.id.au Merged as torvalds/linux@8734b41b3efe0fc6082 I'll leave the issue open until we get the more full featured solution merged. |
PPC32 fix merged as linuxppc/linux@0c85096 |
@joe-lawrence mentioned that this is probably causing more issues: https://lore.kernel.org/linuxppc-dev/YxAc87dTmclHGCUy@redhat.com/ We probably need to do a full solution. |
Commit linuxppc/linux@88fc078 ("x86/module: Use text_poke() for late relocations"):
Now that we have STRICT_MODULE_RWX, I think
arch/powerpc/kernel/module_64.c
, etc need to be updated to use code patching like in commit linuxppc/linux@be24226 ("s390/module: Use s390_kernel_write() for late relocations").The text was updated successfully, but these errors were encountered: