From owner-p4-projects@FreeBSD.ORG Mon Sep 8 04:51:04 2014 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0BE833EA; Mon, 8 Sep 2014 04:51:04 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8A981938 for ; Mon, 8 Sep 2014 04:50:10 +0000 (UTC) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 484E31C5E for ; Mon, 8 Sep 2014 04:50:10 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.9/8.14.9) with ESMTP id s884oAMV023813 for ; Mon, 8 Sep 2014 04:50:10 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.9/8.14.9/Submit) id s884oAPv023810 for perforce@freebsd.org; Mon, 8 Sep 2014 04:50:10 GMT (envelope-from jhb@freebsd.org) Date: Mon, 8 Sep 2014 04:50:10 GMT Message-Id: <201409080450.s884oAPv023810@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin Subject: PERFORCE change 1199102 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.18-1 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Sep 2014 04:51:04 -0000 http://p4web.freebsd.org/@@1199102?ac=10 Change 1199102 by jhb@jhb_pippin on 2014/08/22 21:17:04 Fix mismerge that caused lock recursion. Affected files ... .. //depot/projects/smpng/sys/kern/kern_exec.c#154 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_exec.c#154 (text+ko) ==== @@ -614,18 +614,6 @@ VREF(binvp); /* - * Force the process to use this thread's credentials to avoid - * a race where another thread changed this process' credentials - * while we were waiting for all other threads to stop. - */ - PROC_LOCK(p); - if (td->td_ucred != p->p_ucred) { - oldcred = p->p_ucred; - p->p_ucred = crhold(td->td_ucred); - crfree(oldcred); - } - - /* * For security and other reasons, signal handlers cannot * be shared after an exec. The new process gets a copy of the old * handlers. In execsigs(), the new process will have its signals @@ -643,7 +631,19 @@ PROC_LOCK(p); if (oldsigacts) p->p_sigacts = newsigacts; + + /* + * Force the process to use this thread's credentials to avoid + * a race where another thread changed this process' credentials + * while we were waiting for all other threads to stop. + */ + if (td->td_ucred != p->p_ucred) { + oldcred = p->p_ucred; + p->p_ucred = crhold(td->td_ucred); + crfree(oldcred); + } oldcred = p->p_ucred; + /* Stop profiling */ stopprofclock(p);