[kpatch] livepatch vs kpatch hooks and stack check

Mario Smarduch msmarduch at digitalocean.com
Fri Apr 26 15:40:05 UTC 2019



On 04/26/2019 06:32 AM, Joe Lawrence wrote:
> On 4/26/19 3:51 AM, Mario Smarduch wrote:
>> Hello,
>>    I noticed that with livepatch the old and new functions can
>> run in parallel, but with kpatch the kpatch module load fails on
>> "activeness safety check".
> 
> Hi Mario,
> 
> I think you are referring to kpatch's use of stop_machine() to quiesce
> the system before patching vs. livepatch's consistency model[1] and its
> convergence on a patched state?
> 
>> Am I missing something with livepatch? Is there another way to
>> build and run it?
> 
> AFAIK there is no way around the consistency model with livepatch.  What
> you might be able to do is hack the kpatch-build to utilize the kpatch
> support module instead of the livepatch API.  (Look for the
> $KPATCH_MODULE code in the kpatch-build script.)  I don't think this use
> case is very well tested and in fact, the kpatch.ko will be deprecated
> eventually.


> 
> Do you have a particular case in mind which the livepatch consistency
> model does not support?
The use case is replacing a function that's sleeping somewhere in
uninterruptible mode. With livepatch the function is patched anyway
with new and old functions sharing data. Eventually the old function
wakes up and can result in problems as two have different view of the
shared data (i.e. data field interpretation).

With kpatch it works fine.

> 
> [1]
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/livepatch/livepatch.txt?h=v5.1-rc6#n63
> 
> 
> Regards,
> 
> -- Joe
> 
> _______________________________________________
> kpatch mailing list
> kpatch at redhat.com
> https://www.redhat.com/mailman/listinfo/kpatch




More information about the kpatch mailing list