From patchwork Thu Aug 28 18:31:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 2576 Received: (qmail 5088 invoked by alias); 28 Aug 2014 18:32:04 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 5040 invoked by uid 89); 28 Aug 2014 18:32:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: toccata.ens-lyon.org Date: Thu, 28 Aug 2014 20:31:57 +0200 From: Samuel Thibault To: Roland McGrath Cc: libc-alpha@sourceware.org, bug-hurd@gnu.org Subject: Re: [PATCH,Hurd] Fix hang on fork Message-ID: <20140828183157.GH3011@type.youpi.perso.aquilenet.fr> Mail-Followup-To: Roland McGrath , libc-alpha@sourceware.org, bug-hurd@gnu.org References: <20140827230625.GW3343@type.youpi.perso.aquilenet.fr> <20140828182108.799512C3A5D@topped-with-meat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20140828182108.799512C3A5D@topped-with-meat.com> User-Agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) Roland McGrath, le Thu 28 Aug 2014 11:21:08 -0700, a écrit : > Fix comment formatting, put space before paren, Right, I really need to teach my editor to do the comments properly automatically... > write a ChangeLog entry. This is what I had put, is some information still missing? * sysdeps/mach/hurd/fork.c (__fork): Lock SS->lock around __proc_dostop() call. Signed-off-by: Samuel Thibault --- sysdeps/mach/hurd/fork.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sysdeps/mach/hurd/fork.c b/sysdeps/mach/hurd/fork.c index ab11bab..1f0b8a3 100644 --- a/sysdeps/mach/hurd/fork.c +++ b/sysdeps/mach/hurd/fork.c @@ -122,9 +122,13 @@ __fork (void) ports_locked = 1; + /* Keep our SS locked while stopping other threads, so they don't get a + chance to be having it locked in the copied space. */ + __spin_lock (&ss->lock); /* Stop all other threads while copying the address space, so nothing changes. */ err = __proc_dostop (_hurd_ports[INIT_PORT_PROC].port, ss->thread); + __spin_unlock (&ss->lock); if (!err) { stopped = 1;