Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 May 2002 10:23:58 -0700 (PDT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 11544 for review
Message-ID:  <200205191723.g4JHNwk74620@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=11544

Change 11544 by rwatson@rwatson_curry on 2002/05/19 10:23:13

	Cache td->td_proc in local variable p.
	
	Insert a neglected crcopy() from the new crget/crcopy credential	
	update approach.  This removes crashes/panics due to bogus
	credential data.  I think. :-)

Affected files ...

... //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#146 edit

Differences ...

==== //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#146 (text+ko) ====

@@ -1646,6 +1646,7 @@
 __mac_set_proc(struct thread *td, struct __mac_set_proc_args *uap)
 {
 	struct ucred *newcred, *oldcred;
+	struct proc *p;
 	struct mac newlabel;
 	int error;
 
@@ -1656,24 +1657,26 @@
 		return (error);
 	}
 
+	p = td->td_proc;
 	mtx_lock(&Giant);
-	PROC_LOCK(td->td_proc);
-	oldcred = td->td_proc->p_ucred;
+	PROC_LOCK(p);
+	oldcred = p->p_ucred;
 
 	error = mac_cred_check_relabel_subject(oldcred, &newlabel);
 	if (error) {
-		PROC_UNLOCK(td->td_proc);
+		PROC_UNLOCK(p);
 		crfree(newcred);
 		mtx_unlock(&Giant);
 		return (error);
 	}
 
-	setsugid(td->td_proc);
+	setsugid(p);
+	crcopy(newcred, oldcred);
 	mac_relabel_subject(newcred, &newlabel);
 
-	td->td_proc->p_ucred = newcred;
+	p->p_ucred = newcred;
 
-	PROC_UNLOCK(td->td_proc);
+	PROC_UNLOCK(p);
 	crfree(oldcred);
 	mtx_unlock(&Giant);
 	return (0);

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?200205191723.g4JHNwk74620>