From owner-p4-projects@FreeBSD.ORG Mon Oct 16 19:57:03 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 7791F16A415; Mon, 16 Oct 2006 19:57:03 +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 3A69B16A47B; Mon, 16 Oct 2006 19:57:03 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2311943D79; Mon, 16 Oct 2006 19:56:42 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.6/8.13.6) with ESMTP id k9GJuexl042287; Mon, 16 Oct 2006 15:56:40 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: Roman Divacky Date: Mon, 16 Oct 2006 15:37:27 -0400 User-Agent: KMail/1.9.1 References: <200610141604.k9EG4x8o040869@repoman.freebsd.org> In-Reply-To: <200610141604.k9EG4x8o040869@repoman.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200610161537.27772.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Mon, 16 Oct 2006 15:56:40 -0400 (EDT) X-Virus-Scanned: ClamAV 0.88.3/2037/Mon Oct 16 12:41:42 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: 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: Mon, 16 Oct 2006 19:57:03 -0000 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. -- John Baldwin