PERFORCE change 186576 for review
John Baldwin
jhb at FreeBSD.org
Thu Dec 2 22:07:52 UTC 2010
http://p4web.freebsd.org/@@186576?ac=10
Change 186576 by jhb at jhb_jhbbsd on 2010/12/02 22:06:51
Revert the process back to an exec'ing thread's credentials.
Affected files ...
.. //depot/projects/smpng/sys/kern/kern_exec.c#135 edit
Differences ...
==== //depot/projects/smpng/sys/kern/kern_exec.c#135 (text+ko) ====
@@ -582,12 +582,23 @@
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
* reset.
*/
- PROC_LOCK(p);
oldcred = crcopysafe(p, newcred);
if (sigacts_shared(p->p_sigacts)) {
oldsigacts = p->p_sigacts;
@@ -599,16 +610,6 @@
} else
oldsigacts = NULL;
- /*
- * Ensure that this thread's credentials match the proces
- * credentials.
- */
- if (td->td_ucred != p->p_ucred) {
- oldcred = td->td_ucred;
- td->td_ucred = crhold(p->p_ucred);
- crfree(oldcred);
- }
-
/* Stop profiling */
stopprofclock(p);
More information about the p4-projects
mailing list