From owner-p4-projects Fri Apr 19 6:40:37 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3CCA637B417; Fri, 19 Apr 2002 06:40:27 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by hub.freebsd.org (Postfix) with ESMTP id F090237B41C for ; Fri, 19 Apr 2002 06:40:18 -0700 (PDT) Received: from fledge.watson.org (fledge.pr.watson.org [192.0.2.3]) by fledge.watson.org (8.11.6/8.11.6) with SMTP id g3JDdOw69530 for ; Fri, 19 Apr 2002 09:39:24 -0400 (EDT) (envelope-from robert@fledge.watson.org) Date: Fri, 19 Apr 2002 09:39:24 -0400 (EDT) From: Robert Watson X-Sender: robert@fledge.watson.org To: Perforce Change Reviews Subject: Re: PERFORCE change 9996 for review In-Reply-To: <200204191337.g3JDbXs40812@freefall.freebsd.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This may also close a small race involving process locking, by moving all references to initproc under the locking. In practice, this may not have been an issue given the nascent condition of the system, but it was worth fixing if only to help people who do copy-and-paste programming :-). Robert N M Watson FreeBSD Core Team, TrustedBSD Project robert@fledge.watson.org NAI Labs, Safeport Network Services On Fri, 19 Apr 2002, Robert Watson wrote: > http://people.freebsd.org/~peter/p4db/chv.cgi?CH=9996 > > Change 9996 by rwatson@rwatson_tislabs on 2002/04/19 06:36:48 > > Pro-active diff reduction. > > Restructure the proc0/proc1 credential divorcing to reflect the > crcopy() approach now used in the main tree. This is identical > to the code committed to the main tree a few minutes ago, and > reduces diffs between the trees. > > Affected files ... > > ... //depot/projects/trustedbsd/mac/sys/kern/init_main.c#18 edit > > Differences ... > > ==== //depot/projects/trustedbsd/mac/sys/kern/init_main.c#18 (text+ko) ==== > > @@ -644,12 +644,11 @@ > if (error) > panic("cannot fork init: %d\n", error); > /* divorce init's credentials from the kernel's */ > - oldcred = initproc->p_ucred; > - newcred = crdup(oldcred); > - if (newcred == NULL) > - panic("cannot generate ucred for init: %d\n", error); > + newcred = crget(); > PROC_LOCK(initproc); > initproc->p_flag |= P_SYSTEM; > + oldcred = initproc->p_ucred; > + crcopy(newcred, oldcred); > initproc->p_ucred = newcred; > PROC_UNLOCK(initproc); > crfree(oldcred); > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message