Re: [PATCH] livepatch: add (un)patch hooks

From: Miroslav Benes
Date: Tue Jul 18 2017 - 07:10:57 EST



> > > For the enable case, I think it would be a nice feature if we checked
> > > the return code and aborted the patching operation on error. I think
> > > that should be easy enough.
> >
> > Yeah, that should be easy. To be specific, you're only talking about
> > the patching operation on the associated klp_object, not the entire
> > klp_patch right?
>
> Oh, right, I forgot about modules. We can't stop the module from
> loading, so forget that. Maybe the load hook should just return void.

We can. We can stop a patch module from being loaded if there is an error
coming from a hook, or we can stop a patched module (patch module is
loaded) from being loaded. The latter case is not very user-friendly. We
have force_load_module sysfs attribute for exactly these cases (if an
admin is sure he can safely do that). It is not nice though.

> > > For the unload case, it's too late to do anything, so I'd say a void
> > > return code would be better. Otherwise it implies that we actually do
> > > something about it. Maybe in that case we can leave it up to the user
> > > to decide whether to print an error or WARN() or whatever.
> >
> > Good point. I can change that in v2.

I agree with this point.

Miroslav