Re: livepatch/module: remove livepatch module notifier
From: Petr Mladek
Date: Fri Feb 05 2016 - 05:07:09 EST
On Fri 2016-02-05 10:15:56, Miroslav Benes wrote:
> On Thu, 4 Feb 2016, Jessica Yu wrote:
> > Argh, thank you for catching that. I think we could split up
> > complete_formation()
> > into two functions in order to make the error handling work.
> >
> > Does all this look ok?
>
> Hm, there is an another option. We can cover the needed error handling in
> complete_formation(). So for the first error there
> (verify_export_symbols() fails) we need to only release module_mutex. For
> our second error we need more. We would call module_bug_cleanup() under
> module_mutex, module_disable_{ro,nx} and going notifiers. Is this correct?
> It would be hidden in complete_formation() this way and cleaner in my
> opinion. There is some code duplication though.
This sounds better to me.
> > Also, one last thing, I noticed that module->state
> > isn't
> > set to MODULE_STATE_GOING anywhere before the going notifier chain is called
> > in
> > the bug_cleanup label (I think it is still COMING at that point), so the
> > klp_module_disable call right afterwards would have bailed out because of
> > that.
> > To be consistent, shouldn't it be set before the going notifiers are called?
>
> This could break something or introduce a race somewhere. Git grep says
> there are several checks for MODULE_STATE_GOING through out the kernel
> which need to be checked.
I think that we could relax the condition in the
klp_module_going/disable() function and allow to call it
also in MODULE_STATE_COMMING_STATE. It would deserve
a comment.
Best Regards,
Petr