From owner-p4-projects@FreeBSD.ORG Tue Oct 17 08:14:56 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 52ED416A4A0; Tue, 17 Oct 2006 08:14:56 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2BD6D16A47C; Tue, 17 Oct 2006 08:14:56 +0000 (UTC) (envelope-from xdivac02@stud.fit.vutbr.cz) Received: from eva.fit.vutbr.cz (eva.fit.vutbr.cz [147.229.176.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 59D5843D8B; Tue, 17 Oct 2006 08:14:43 +0000 (GMT) (envelope-from xdivac02@stud.fit.vutbr.cz) Received: from eva.fit.vutbr.cz (localhost [127.0.0.1]) by eva.fit.vutbr.cz (envelope-from xdivac02@eva.fit.vutbr.cz) (8.13.8/8.13.7) with ESMTP id k9H8EgpG073599 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 17 Oct 2006 10:14:42 +0200 (CEST) Received: (from xdivac02@localhost) by eva.fit.vutbr.cz (8.13.8/8.13.3/Submit) id k9H8Egb9073598; Tue, 17 Oct 2006 10:14:42 +0200 (CEST) Date: Tue, 17 Oct 2006 10:14:42 +0200 From: Divacky Roman To: John Baldwin Message-ID: <20061017081441.GA73503@stud.fit.vutbr.cz> References: <200610141604.k9EG4x8o040869@repoman.freebsd.org> <200610161537.27772.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200610161537.27772.jhb@freebsd.org> User-Agent: Mutt/1.4.2.2i X-Scanned-By: MIMEDefang 2.57 on 147.229.176.14 Cc: Roman Divacky , Perforce Change Reviews Subject: Re: PERFORCE change 107903 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Oct 2006 08:14:56 -0000 On Mon, Oct 16, 2006 at 03:37:27PM -0400, John Baldwin wrote: > On Saturday 14 October 2006 12:04, Roman Divacky wrote: > > http://perforce.freebsd.org/chv.cgi?CH=107903 > > > > Change 107903 by rdivacky@rdivacky_witten on 2006/10/14 16:04:47 > > > > A bunch of fixes that makes this not panic when killpg() is called. > > > > Affected files ... > > > > .. //depot/projects/linuxolator/src/sys/compat/linux/linux_emul.c#10 edit > > > > Differences ... > > > > ==== //depot/projects/linuxolator/src/sys/compat/linux/linux_emul.c#10 > (text+ko) ==== > > > > @@ -212,8 +212,12 @@ > > q = LIST_FIRST(&p->p_children); > > for (; q != NULL; q = nq) { > > nq = LIST_NEXT(q, p_sibling); > > - if (__predict_true(q->p_sysent != &elf_linux_sysvec)) > > - break; > > + PROC_LOCK(q); > > + if (q->p_flag & P_WEXIT) > > + continue; > > + PROC_UNLOCK(q); > > + if (__predict_false(q->p_sysent != &elf_linux_sysvec)) > > + continue; > > em = em_find(q, EMUL_UNLOCKED); > > KASSERT(em != NULL, ("linux_reparent: emuldata not found: %i\n", > q->p_pid)); > > if (em->pdeath_signal != 0) { > > Holding the proc lock doesn't buy you anything here. Probably you should hold > an slock of the proctree_lock while you walk the list, and that should be > good enough to test P_WEXIT. However, even if you didn't hold it, grabbing > the lock just to do a read doesn't buy you anything as far as closing race > conditions. I am already holding the proctree_lock... so I'll just remove the PROC_LOCK() on the other hand.. I am very not sure about the locking I do but when I do it otherwiuse I am getting a LOR... hard situation :(