From owner-p4-projects@FreeBSD.ORG Thu Jun 8 21:53:10 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 18B5D16A47E; Thu, 8 Jun 2006 21:53:10 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CCD5E16A559 for ; Thu, 8 Jun 2006 21:53:09 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9AC9A44E15 for ; Thu, 8 Jun 2006 19:49:56 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k58JlwgX060488 for ; Thu, 8 Jun 2006 19:47:58 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k58Jlw1h060485 for perforce@freebsd.org; Thu, 8 Jun 2006 19:47:58 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Thu, 8 Jun 2006 19:47:58 GMT Message-Id: <200606081947.k58Jlw1h060485@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 98824 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jun 2006 21:53:10 -0000 http://perforce.freebsd.org/chv.cgi?CH=98824 Change 98824 by rwatson@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); }