Re: [PATCH v6] livepatch: Clear relocation targets on a module removal

From: Petr Mladek
Date: Fri Dec 09 2022 - 09:20:37 EST


On Fri 2022-12-09 14:54:10, Petr Mladek wrote:
> On Mon 2022-11-28 17:57:06, Song Liu wrote:
> > On Fri, Nov 18, 2022 at 8:24 AM Petr Mladek <pmladek@xxxxxxxx> wrote:
> > > > --- a/kernel/livepatch/core.c
> > > > +++ b/kernel/livepatch/core.c
> I see that you removed also:
>
> if (strcmp(objname ? objname : "vmlinux", sec_objname))
> return 0;
>
> This is another bug in your "simplification".

This actually is not a bug. It was replaced by the strcmp() check below.

> > > > +
> > > > + if (strcmp(objname, sec_objname))
> > > > + continue;

But this works only because the function is not called for "vmlinux".
It can't be unloaded.

Well, this optimization is not worth it. IMHO, it is better when
the API is able to handle "vmlinux" object a safe way.

We always try to make the livepatch API as error-proof as possible.
It is the main idea of livepatching. It should fix bugs without
breaking the running system.

Best Regards,
Petr