Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Apr 2002 09:39:24 -0400 (EDT)
From:      Robert Watson <rwatson@freebsd.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   Re: PERFORCE change 9996 for review
Message-ID:  <Pine.NEB.3.96L.1020419093838.64976t-100000@fledge.watson.org>
In-Reply-To: <200204191337.g3JDbXs40812@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96L.1020419093838.64976t-100000>