Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753251AbcDENxY (ORCPT ); Tue, 5 Apr 2016 09:53:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51455 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751958AbcDENxW (ORCPT ); Tue, 5 Apr 2016 09:53:22 -0400 Date: Tue, 5 Apr 2016 08:53:21 -0500 From: Josh Poimboeuf To: Vojtech Pavlik Cc: Miroslav Benes , Jiri Kosina , Jessica Yu , linux-kernel@vger.kernel.org, live-patching@vger.kernel.org Subject: Re: [RFC PATCH v1.9 12/14] livepatch: create per-task consistency model Message-ID: <20160405135321.y4hmoghfa2ukwj5w@treble.redhat.com> References: <74a2b37cea7a64a185e50876dba031137aa59a24.1458933243.git.jpoimboe@redhat.com> <20160404182138.pjze2fvtmknq2ksq@treble.redhat.com> <20160404182759.GA10777@suse.cz> <20160404183307.2hbht3g4l7ei54rt@treble.redhat.com> <20160405113634.GA5930@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20160405113634.GA5930@suse.cz> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2367 Lines: 52 On Tue, Apr 05, 2016 at 01:36:34PM +0200, Vojtech Pavlik wrote: > On Mon, Apr 04, 2016 at 01:33:07PM -0500, Josh Poimboeuf wrote: > > On Mon, Apr 04, 2016 at 08:27:59PM +0200, Vojtech Pavlik wrote: > > > On Mon, Apr 04, 2016 at 01:21:38PM -0500, Josh Poimboeuf wrote: > > > > > > > Hm, can you explain why it should be copied from the parent? > > > > > > > > I'm thinking the above code is correct for today, but it should still be > > > > changed to be more future-proof. > > > > > > > > Here's my thinking: > > > > > > > > A forked task starts out with no stack, so if I understand correctly, it > > > > can safely start out in the goal universe, regardless of which universe > > > > its parent belongs to. > > > > > > > > However, the current ret_from_fork code is a mess, and Andy Lutomirski > > > > has mentioned that he would like to give newly forked tasks a proper > > > > stack such that instead of jumping to ret_from_fork, they would just > > > > return from schedule(). In that case, it would no longer be safe to > > > > start the new task in the goal universe because it could be "sleeping" > > > > on a to-be-patched function. > > > > > > > > So for proper future proofing, newly forked tasks should be started in > > > > the initial universe (rather than starting in the goal universe or > > > > inheriting the parent's universe). They can then be transitioned over > > > > to the goal universe like any other task. How does that sound? > > > > > > How could a newly forked task start in the old universe if its parent > > > has already been migrated? Any context it inherits will already be from > > > the new universe. > > > > Can you be more specific about "context" and why inheritance of it would > > be a problem? > > Currently a forked task starts out with no stack, and as such it can > start in the goal universe. > > If we create a synthetic stack, then we may need to start in the initial > universe, as the synthetic stack would likely be created using initial > universe return addresses. > > If we simply copy the stack of the parent process, which is in my > opionion the safest way, as it places little assumptions on the > compiler, then it may contain either old or new addresses > and we need to copy the universe flag along. That all makes sense. I'll change it to inherit the parent's universe for now. -- Josh