add livepatch API support#477
Conversation
Adds a new patch module scaffold for use when building against a kernel with CONFIG_LIVE_PATCHING=y. Signed-off-by: Seth Jennings <[email protected]>
|
This is awesome (see animated gif ;-) The scaffolding is ok for now. Hopefully we can eventually figure out a way to build the klp_patch struct at build time instead of run time, so that the patch template can be nice and lean. We might need to add more intelligence to the linking step somehow. I'll add some code comments inline. |
kmod/patch/livepatch-patch-hook.c
Outdated
There was a problem hiding this comment.
Because of the scaffolding, there are three different structure "languages" being used: kpatch-build, scaffolding, and klp. It kind of threw me for a loop when trying to read this code. It would be easier to follow if the same variable, struct, and function naming conventions were used consistently throughout the entire file. Something like:
- for kpatch-build: kpatch/kobject/kreloc/kfunc
- for temporary scaffolding: tpatch/tobject/treloc/tfunc (or spatch/sobject/sreloc/sfunc)
- for klp: lpatch/lobject/lreloc/tfunc
And also maybe a comment describing the fact that there are three languages and the different naming conventions.
|
end comments |
Signed-off-by: Seth Jennings <[email protected]>
|
Regarding making the klp_patch structure at build time, I think that would be quite an undertaking. You'd need a separate program to read in the all the kpatch sections from all of the changed objects, create the section that contains the klp_patch structure, and exclude the (now temporary) kpatch section from the final linking. I'm pretty confident that it would be more code than this scaffold. |
|
I agree it would be more code than this, but I don't think it would be too bad. It could come along after ld has done its work. That way it would only have to read output.o instead of all the objects. It would have the benefit of vastly simplifying the patch template code, and build time complexity is much better than run time complexity IMO. |
|
Or it might even be possible to implement it in the linker script... that would be ideal. |
|
Looks good. One more comment: The global I still need to do some testing with it. |
|
We also need to update the kpatch script to work with both (can use a separate GH issue to track that) |
Signed-off-by: Seth Jennings <[email protected]>
Signed-off-by: Seth Jennings <[email protected]>
|
new "add naming" commit renames patch to lpatch. it does need to be global though for unregister in patch_exit() |

Adds a new patch module scaffold for use when building against a kernel
with CONFIG_LIVE_PATCHING=y.
Fixes issue #476
Signed-off-by: Seth Jennings [email protected]