PERFORCE change 98824 for review
Robert Watson
rwatson at FreeBSD.org
Thu Jun 8 22:10:50 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=98824
Change 98824 by rwatson at rwatson_sesame on 2006/06/08 19:47:18
Lock process when copying fields from process structure so as to
get a consistent snapshot, as well as get consistent values (i.e.,
that p_comm is properly nul-terminated).
Affected files ...
.. //depot/projects/trustedbsd/audit3/sys/security/audit/audit.c#32 edit
Differences ...
==== //depot/projects/trustedbsd/audit3/sys/security/audit/audit.c#32 (text+ko) ====
@@ -171,20 +171,19 @@
/*
* Export the subject credential.
- *
- * XXXAUDIT: td_ucred access is OK without proc lock, but some other
- * fields here may require the proc lock.
*/
cru2x(td->td_ucred, &ar->k_ar.ar_subj_cred);
ar->k_ar.ar_subj_ruid = td->td_ucred->cr_ruid;
ar->k_ar.ar_subj_rgid = td->td_ucred->cr_rgid;
ar->k_ar.ar_subj_egid = td->td_ucred->cr_groups[0];
+ PROC_LOCK(td->td_proc);
ar->k_ar.ar_subj_auid = td->td_proc->p_au->ai_auid;
ar->k_ar.ar_subj_asid = td->td_proc->p_au->ai_asid;
ar->k_ar.ar_subj_pid = td->td_proc->p_pid;
ar->k_ar.ar_subj_amask = td->td_proc->p_au->ai_mask;
ar->k_ar.ar_subj_term = td->td_proc->p_au->ai_termid;
bcopy(td->td_proc->p_comm, ar->k_ar.ar_subj_comm, MAXCOMLEN);
+ PROC_UNLOCK(td->td_proc);
return (0);
}
More information about the trustedbsd-cvs
mailing list