Date: Thu, 2 Dec 2010 22:07:51 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 186576 for review Message-ID: <201012022207.oB2M7plN035435@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@186576?ac=10 Change 186576 by jhb@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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201012022207.oB2M7plN035435>