-
Notifications
You must be signed in to change notification settings - Fork 304
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
kpatch script compatibility with livepatch #479
Comments
It might be easier to just add a MODULE_INFO attribute to each type of patch module to indicate whether or not it is a livepatch or kpatch module. The kpatch script can then act accordingly based on this module attribute via modinfo -F. Then when the patch module loads, export a flag somewhere in |
A livepatch-enabled kernel already has |
(Similarly, the kpatch core module creates the That said, it might be nice to have the livepatch interfaces and the kpatch interfaces be as similar as possible, to reduce the burden of supporting both for the foreseeable future. |
/digging up this bug since I hit it using |
Good question. kpatch-build already decides which type of module to build based on CONFIG_LIVEPATCH, so it shouldn't even be possible for kpatch modules to be built for a livepatch-enabled kernel. And nobody has complained about that. So I think looking at In any case kpatch.ko will hopefully be obsolete soon, shortly after the livepatch consistency model gets merged.
No, if only for consistency with our current policy. Maybe add a CONFIG_LIVEPATCH check with all the other config checks at the top of kmod/core/core.c? |
BTW, another reason kpatch.ko shouldn't be supported for livepatch kernels is that we don't want people loading both types of modules on the same system, as fireworks may ensue. |
So a patch to disable the |
Sounds good. |
@joe-lawrence Just a heads up, I think there might be some kpatch-specific checks in the kpatch script. The |
@flaming-toast If I understand correctly, the checksum sysfs code can't be ported to the livepatch hook because the livepatch sysfs entries are created by the upstream livepatch code. So then I guess we need to figure out if we care enough about the checksum feature to try to get it ported to upstream livepatch. It's Friday afternoon so I don't have an opinion yet :-) |
@jpoimboe Whoops, you are right. So looks like we can't do it from livepatch-patch-hook after all. I needed to refresh my memory on why we added the checksum section :-) See here: #343 (comment)
I feel like we only have the checksum for the benefit of our userspace tools (kpatch script), so not sure what upstream would say. We also manually create and insert the checksum in our kpatch-build script, so the manual kbuild approach would miss out (or maybe change to use srcversion there). |
@flaming-toast - does Regardless of which unique identifier we end up picking, and in the interest of backwards compatibility, should the Also does |
If there isn't an easy and simple way to support checksums, I would vote to just drop that feature, and assume that a patch with the same name has the same content. In practice, we do versioning by changing the patch name, and I think that is a common and reasonable approach. |
Livepatch modules can be supported with minimal changes to the kpatch script. Adjust for appropriate sysfs paths, core-patching code (in kernel for livepatch, kpatch.ko for kpatch), and checksum verification (only verify the checksum if it exists). Fixes dynup#479.
If comparing checksums only when one is present in sysfs is sufficient (ie, kpatch only, or if livepatch ever adopts one), then this commit should do the trick. At least with this in place, load/install/unload* actions work on both CentOS (kpatch) and Ubuntu (livepatch) installs. *unload doesn't actually remove livepatch modules... this could be clarified in a warn msg or left in place for when/if livepatch ever adds this functionality. |
@joe-lawrence that's fine, we can continue to support checksums for kpatch.ko without breaking livepatch. |
Livepatch modules can be supported with minimal changes to the kpatch script. Adjust for appropriate sysfs paths, core-patching code (in kernel for livepatch, kpatch.ko for kpatch), and checksum verification (only verify the checksum if it exists). Fixes dynup#479.
Livepatch modules can be supported with minimal changes to the kpatch script. Adjust for appropriate sysfs paths, core-patching code (in kernel for livepatch, kpatch.ko for kpatch), and checksum verification (only verify the checksum if it exists). Fixes dynup#479.
Make the kpatch script compatible with both the kpatch core module and livepatch.
This might involve making the kpatch core module sysfs interface identical to the livepatch interface.
The text was updated successfully, but these errors were encountered: