PERFORCE change 47703 for review

John Baldwin jhb at FreeBSD.org
Thu Feb 26 11:12:39 PST 2004


http://perforce.freebsd.org/chv.cgi?CH=47703

Change 47703 by jhb at jhb_slimer on 2004/02/26 11:12:06

	After talking with Robert, re-sync exec'ing thread credentials with
	process credentials rather than vice versa.

Affected files ...

.. //depot/projects/smpng/sys/kern/kern_exec.c#66 edit
.. //depot/projects/smpng/sys/notes#9 edit

Differences ...

==== //depot/projects/smpng/sys/kern/kern_exec.c#66 (text+ko) ====

@@ -223,7 +223,7 @@
 {
 	struct proc *p = td->td_proc;
 	struct nameidata nd, *ndp;
-	struct ucred *newcred = NULL, *oldcred;
+	struct ucred *newcred = NULL, *oldcred = NULL;
 	struct uidinfo *euip;
 	register_t *stack_base;
 	int error, len, i;
@@ -269,12 +269,14 @@
 		td->td_mailbox = NULL;
 		thread_single_end();
 		if (td->td_ucred != p->p_ucred) {
-			crfree(p->p_ucred);
-			p->p_ucred = crhold(td->td_ucred);
+			oldcred = td->td_ucred;
+			td->td_ucred = crhold(p->p_ucred);
 		}
 	}
 	p->p_flag |= P_INEXEC;
 	PROC_UNLOCK(p);
+	if (oldcred != NULL)
+		crfree(oldcred);
 
 	/*
 	 * Initialize part of the common data

==== //depot/projects/smpng/sys/notes#9 (text+ko) ====

@@ -26,10 +26,9 @@
   - Untested
 - Fixup asm constraints for i386/isa/bs/bsif.h
   - Untested
-- Fixup p_ucred to use the ucred of the thread doing the actual execve()
-  during an exec.  This change is actually split across the jhb_proc and
-  smpng branches.
-  - Untested, also not sure if this is strictly correct.
+- Fixup td_ucred of thread doing execve() to re-sync with process ucred
+  after single threading during an exec.
+  - Untested
 - Move lock checks and enabling of an ithread's interrupt source earlier
   in ithread_loop().
   - Tested only on my laptop


More information about the p4-projects mailing list