PERFORCE change 84040 for review

Robert Watson rwatson at FreeBSD.org
Wed Sep 21 10:40:44 GMT 2005


http://perforce.freebsd.org/chv.cgi?CH=84040

Change 84040 by rwatson at 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;
 	}
 
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list