Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Sep 2005 10:40:44 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 84040 for review
Message-ID:  <200509211040.j8LAeibI039951@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=84040

Change 84040 by rwatson@rwatson_zoo on 2005/09/21 10:40:30

	When auditing a file descriptor argument, conditionally acquire Giant
	and unconditionally acquire the vnode lock around the call to audit
	the vnode.  Drop one or both.

Affected files ...

.. //depot/projects/trustedbsd/audit3/sys/security/audit/kern_audit.c#31 edit

Differences ...

==== //depot/projects/trustedbsd/audit3/sys/security/audit/kern_audit.c#31 (text+ko) ====

@@ -2153,12 +2153,19 @@
 	struct kaudit_record *ar;
 	struct socket *so;
 	struct inpcb *pcb;
+	struct vnode *vp;
+	int vfslocked;
 
 	/*
 	 * XXXAUDIT: Why is the (ar == NULL) test only in the socket case?
 	 */
 	if (fp->f_type == DTYPE_VNODE) {
-		audit_arg_vnpath((struct vnode *)fp->f_data, ARG_VNODE1);
+		vp = fp->f_data;
+		vfslocked = VFS_LOCK_GIANT(vp->v_mount);
+		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curthread);
+		audit_arg_vnpath(vp, ARG_VNODE1);
+		VOP_UNLOCK(vp, 0, curthread);
+		VFS_UNLOCK_GIANT(vfslocked);
 		return;
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200509211040.j8LAeibI039951>