[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150518152221.GA8995@treble.redhat.com>
Date: Mon, 18 May 2015 10:22:21 -0500
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: Petr Mladek <pmladek@...e.cz>
Cc: Minfei Huang <mnfhuang@...il.com>, mbenes@...e.cz,
sjenning@...hat.com, jkosina@...e.cz, vojtech@...e.cz,
live-patching@...r.kernel.org, linux-kernel@...r.kernel.org,
mhuang@...hat.com
Subject: Re: [PATCH v3] livepatch: Prevent to apply the patch once coming
module notifier fails
On Mon, May 18, 2015 at 02:08:06PM +0200, Petr Mladek wrote:
> On Wed 2015-05-13 09:14:15, Josh Poimboeuf wrote:
> > On Tue, May 12, 2015 at 10:04:44PM +0800, Minfei Huang wrote:
> > > @@ -930,6 +932,7 @@ disabled:
> > > static int klp_module_notify(struct notifier_block *nb, unsigned long action,
> > > void *data)
> > > {
> > > + int ret;
> > > struct module *mod = data;
> > > struct klp_patch *patch;
> > > struct klp_object *obj;
> > > @@ -955,7 +958,13 @@ static int klp_module_notify(struct notifier_block *nb, unsigned long action,
> > >
> > > if (action == MODULE_STATE_COMING) {
> > > obj->mod = mod;
> > > - klp_module_notify_coming(patch, obj);
> > > + ret = klp_module_notify_coming(patch, obj);
> > > + if (ret) {
> > > + obj->mod = NULL;
> > > + pr_warn("patch '%s' is dead, remove it "
> > > + "or re-install the module '%s'\n",
> > > + patch->mod->name, obj->name);
> > > + }
> >
> > The patch isn't necessarily dead, since it might also include previously
> > enabled changes for vmlinux or other modules. It can actually be a
> > dangerous condition if there's a mismatch between old code in the module
> > and new code elsewhere. How about something like:
> >
> > "patch '%s' is in an inconsistent state!\n"
>
> It must not be dangerous, otherwise the patch could not get applied
> immediately.
>
> I would omit this message completely. It would just duplicate the
> warning printed by klp_module_notify_coming().
This error path doesn't mean that the entire patch isn't applied. It
only affects the subset of the patch which applies to the coming module.
So you can have a dangerous mismatch in the case of a patch which
patches multiple objects.
--
Josh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists