freebsd-dev/sys/cddl/contrib/opensolaris/uts
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
..
aarch64 First cut of DTrace for AArch64. 2015-07-01 15:51:11 +00:00
arm Initial version of DTrace on ARM32. 2015-02-10 19:41:30 +00:00
common Avoid dereferencing curthread->td_proc->p_cred in DTrace probe context. 2015-08-02 00:11:56 +00:00
intel Mechanically convert cddl sun #ifdef's to illumos 2015-01-17 14:44:59 +00:00
mips Add MIPS support to cddl/contrib part: 2012-03-24 04:52:18 +00:00
powerpc Fix a couple bugs in 64-bit powerpc fasttrap argument retrieval. 2015-05-10 04:33:01 +00:00
sparc MFC r270195: 2014-08-20 21:44:48 +00:00