[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150312192303.GA32376@treble.redhat.com>
Date: Thu, 12 Mar 2015 14:23:03 -0500
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: Petr Mladek <pmladek@...e.cz>
Cc: Seth Jennings <sjenning@...hat.com>, Jiri Kosina <jkosina@...e.cz>,
Rusty Russell <rusty@...tcorp.com.au>,
Miroslav Benes <mbenes@...e.cz>,
Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
mingo@...nel.org, mathieu.desnoyers@...icios.com, oleg@...hat.com,
paulmck@...ux.vnet.ibm.com, live-patching@...r.kernel.org,
linux-kernel@...r.kernel.org, andi@...stfloor.org,
rostedt@...dmis.org, tglx@...utronix.de
Subject: Re: [PATCH v4] livepatch/module: Correctly handle coming and going
modules
On Thu, Mar 12, 2015 at 12:55:13PM +0100, Petr Mladek wrote:
> There is a notifier that handles live patches for coming and going modules.
> It takes klp_mutex lock to avoid races with coming and going patches but
> it does not keep the lock all the time. Therefore the following races are
> possible:
>
> 1. The notifier is called sometime in STATE_MODULE_COMING. The module
> is visible by find_module() in this state all the time. It means that
> new patch can be registered and enabled even before the notifier is
> called. It might create wrong order of stacked patches, see below
> for an example.
>
> 2. New patch could still see the module in the GOING state even after
> the notifier has been called. It will try to initialize the related
> object structures but the module could disappear at any time. There
> will stay mess in the structures. It might even cause an invalid
> memory access.
>
> This patch solves the problem by adding a boolean variable into struct module.
> The value is true after the coming and before the going handler is called.
> New patches need to be applied when the value is true and they need to ignore
> the module when the value is false.
Acked-by: Josh Poimboeuf <jpoimboe@...hat.com>
--
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