kernel - Fix rare allproc scan vs p_ucred race
* This race can occur because p->p_ucred can change out from under
an allproc scan when the allproc scan is filtering based on
credentials.
* Access p->p_ucred via the per-process spinlock (p->p_spin). Also
maintain a cache of the last ucred during the loop in order to
avoid having to spin-lock every process.
* Add missing spinlock around p->p_ucred = NULL in exit1(). This
is also only applicable to races against allproc scans since
p_token is held during exit1().
Reported-by: mjg_