freebsd-dev/sys/cddl/contrib/opensolaris
Mark Johnston 48fcd357c4 Avoid dereferencing curthread->td_proc->p_cred in DTrace probe context.
When a process is exiting, there is a narrow window where p_cred may be
NULL while its threads are still executing. Specifically, the last thread
to exit a process sets the process state to PRS_ZOMBIE with the proc
spinlock held and then calls thread_exit(). thread_exit() drops the spin
lock, permitting the process to be reaped and thus causing its cred struct
to be released. However, the exiting thread may still cause DTrace probes
to fire by calling sched_throw(), resulting in a double fault if such a
probe enabling attempts to access the GID or UID DIF variables.

The thread's cred reference is not susceptible to this race since it is not
released until after the thread has exited.

MFC after:	1 week
2015-08-02 00:11:56 +00:00
..
common Rename zfs nvpair files to not colidate with our nvlist. 2015-07-09 21:53:40 +00:00
uts Avoid dereferencing curthread->td_proc->p_cred in DTrace probe context. 2015-08-02 00:11:56 +00:00
OPENSOLARIS.LICENSE