From owner-freebsd-java@FreeBSD.ORG Mon Dec 3 04:53:05 2007 Return-Path: Delivered-To: java@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C94B16A418; Mon, 3 Dec 2007 04:53:05 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from mail.netplex.net (mail.netplex.net [204.213.176.10]) by mx1.freebsd.org (Postfix) with ESMTP id DF44513C501; Mon, 3 Dec 2007 04:53:04 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.netplex.net (8.14.2/8.14.2/NETPLEX) with ESMTP id lB34r2WN005132; Sun, 2 Dec 2007 23:53:02 -0500 (EST) X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.netplex.net) X-Greylist: Message whitelisted by DRAC access database, not delayed by milter-greylist-4.0 (mail.netplex.net [204.213.176.10]); Sun, 02 Dec 2007 23:53:03 -0500 (EST) Date: Sun, 2 Dec 2007 23:53:02 -0500 (EST) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: David Xu In-Reply-To: <47536361.8090203@freebsd.org> Message-ID: References: <200711301716.lAUHGEV1064334@repoman.freebsd.org> <47536361.8090203@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: nate@yogotech.com, java@freebsd.org, julian@freebsd.org Subject: Re: cvs commit: src/lib/libkse/thread thr_kern.c X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Eischen List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Dec 2007 04:53:05 -0000 On Mon, 3 Dec 2007, David Xu wrote: > Daniel Eischen wrote: >> >> >> Yes, this would seem to be a kernel problem, as _get_curthread() >> seems to be returning garbage. This is a libkse MD function, >> that relies on %gs (for i386/amd64) to point to something >> that was initialized in the parent. >> >> Julian, David, got any ideas? >> > > I don't know, I am still reading some kernel code. I think it is possible that the fork()ing thread blocks before the vm space is copied to the child and an upcall is made. The curthread is changed before the vm space is copied (or set to NULL) in the parent KSE/thread. Then the child thread/process unblocks and completes, getting a copy of the vm space with curthread set to an invalid value (NULL or another now non-existent thread). I'm not sure what is suppose to happen with fork() in this case. Perhaps I should just commit the patch to work around the problem, or put the KSE in a critical region across a fork() so that an upcall doesn't happen. I'm not sure why libthr has similar problems, although harder to reproduce. This would seem a problem limited to libkse. -- DE