Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754006AbbBJT2H (ORCPT ); Tue, 10 Feb 2015 14:28:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52758 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753362AbbBJT2F (ORCPT ); Tue, 10 Feb 2015 14:28:05 -0500 Date: Tue, 10 Feb 2015 13:27:59 -0600 From: Seth Jennings To: Josh Poimboeuf Cc: Jiri Kosina , Vojtech Pavlik , Masami Hiramatsu , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 6/9] livepatch: create per-task consistency model Message-ID: <20150210192759.GA16787@cerebellum.variantweb.net> References: <2c3d1e685dae5cccc2dfdb1b24c241b2f1c89348.1423499826.git.jpoimboe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2c3d1e685dae5cccc2dfdb1b24c241b2f1c89348.1423499826.git.jpoimboe@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3728 Lines: 100 On Mon, Feb 09, 2015 at 11:31:18AM -0600, Josh Poimboeuf wrote: > Add a basic per-task consistency model. This is the foundation which > will eventually enable us to patch those ~10% of security patches which > change function prototypes and/or data semantics. > > When a patch is enabled, livepatch enters into a transition state where > tasks are converging from the old universe to the new universe. If a > given task isn't using any of the patched functions, it's switched to > the new universe. Once all the tasks have been converged to the new > universe, patching is complete. > > The same sequence occurs when a patch is disabled, except the tasks > converge from the new universe to the old universe. > > The /sys/kernel/livepatch//transition file shows whether a patch > is in transition. Only a single patch (the topmost patch on the stack) > can be in transition at a given time. A patch can remain in the > transition state indefinitely, if any of the tasks are stuck in the > previous universe. > > A transition can be reversed and effectively canceled by writing the > opposite value to the /sys/kernel/livepatch//enabled file while > the transition is in progress. Then all the tasks will attempt to > converge back to the original universe. > > Signed-off-by: Josh Poimboeuf > --- > include/linux/livepatch.h | 18 ++- > include/linux/sched.h | 3 + > kernel/fork.c | 2 + > kernel/livepatch/Makefile | 2 +- > kernel/livepatch/core.c | 71 ++++++---- > kernel/livepatch/patch.c | 34 ++++- > kernel/livepatch/patch.h | 1 + > kernel/livepatch/transition.c | 300 ++++++++++++++++++++++++++++++++++++++++++ > kernel/livepatch/transition.h | 16 +++ > kernel/sched/core.c | 2 + > 10 files changed, 423 insertions(+), 26 deletions(-) > create mode 100644 kernel/livepatch/transition.c > create mode 100644 kernel/livepatch/transition.h > > diff --git a/kernel/livepatch/transition.h b/kernel/livepatch/transition.h > new file mode 100644 > index 0000000..ba9a55c > --- /dev/null > +++ b/kernel/livepatch/transition.h > @@ -0,0 +1,16 @@ > +#include > + > +enum { > + KLP_UNIVERSE_UNDEFINED = -1, > + KLP_UNIVERSE_OLD, > + KLP_UNIVERSE_NEW, > +}; > + > +extern struct mutex klp_mutex; klp_mutex isn't defined in transition.c. Maybe this extern should be in the transition.c file or in a core.h file, since core.c provides the definition? Thanks, Seth > +extern struct klp_patch *klp_transition_patch; > + > +extern void klp_init_transition(struct klp_patch *patch, int universe); > +extern void klp_start_transition(int universe); > +extern void klp_reverse_transition(void); > +extern void klp_try_complete_transition(void); > +extern void klp_complete_transition(void); > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index 78d91e6..7b877f4 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -74,6 +74,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -4601,6 +4602,7 @@ void init_idle(struct task_struct *idle, int cpu) > #if defined(CONFIG_SMP) > sprintf(idle->comm, "%s/%d", INIT_TASK_COMM, cpu); > #endif > + klp_update_task_universe(idle); > } > > int cpuset_cpumask_can_shrink(const struct cpumask *cur, > -- > 2.1.0 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/