PERFORCE change 84053 for review

Robert Watson rwatson at FreeBSD.org
Wed Sep 21 12:31:04 GMT 2005


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

Change 84053 by rwatson at rwatson_zoo on 2005/09/21 12:30:38

	Move a number of calls to audit vnode path information to the
	point where VFS locking is in place already.  We need to carefully
	consider whether these changes in placement give the desired
	semantics still, but do offer increased atomicity as they move
	audit data gathering to the same lock instance as the operation
	itself.

Affected files ...

.. //depot/projects/trustedbsd/audit3/sys/kern/vfs_syscalls.c#13 edit

Differences ...

==== //depot/projects/trustedbsd/audit3/sys/kern/vfs_syscalls.c#13 (text+ko) ====

@@ -329,7 +329,11 @@
 		return (error);
 	mtx_lock(&Giant);
 
+#ifdef AUDIT
+	vn_lock(fp->f_vnode, LK_EXCLUSIVE | LK_RETRY, td);
 	AUDIT_ARG(vnpath, fp->f_vnode, ARG_VNODE1);
+	VOP_UNLOCK(fp->f_vnode, 0, td);
+#endif
 
 	mp = fp->f_vnode->v_mount;
 	fdrop(fp, td);
@@ -2351,6 +2355,7 @@
 		return (error);
 	VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
 	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
+	AUDIT_ARG(vnpath, vp, ARG_VNODE1);
 	VATTR_NULL(&vattr);
 	vattr.va_flags = flags;
 #ifdef MAC
@@ -2452,8 +2457,6 @@
 		return (error);
 	vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount);
 
-	AUDIT_ARG(vnpath, fp->f_vnode, ARG_VNODE1);
-
 	error = setfflags(td, fp->f_vnode, uap->flags);
 	fdrop(fp, td);
 	VFS_UNLOCK_GIANT(vfslocked);
@@ -2617,6 +2620,7 @@
 		return (error);
 	VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
 	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
+	AUDIT_ARG(vnpath, vp, ARG_VNODE1);
 	VATTR_NULL(&vattr);
 	vattr.va_uid = uid;
 	vattr.va_gid = gid;
@@ -2747,8 +2751,6 @@
 		return (error);
 	vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount);
 
-	AUDIT_ARG(vnpath, fp->f_vnode, ARG_VNODE1);
-
 	error = setfown(td, fp->f_vnode, uap->uid, uap->gid);
 	fdrop(fp, td);
 	VFS_UNLOCK_GIANT(vfslocked);
@@ -2806,6 +2808,7 @@
 		return (error);
 	VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
 	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
+	AUDIT_ARG(vnpath, vp, ARG_VNODE1);
 	setbirthtime = 0;
 	if (numtimes < 3 && VOP_GETATTR(vp, &vattr, td->td_ucred, td) == 0 &&
 	    timespeccmp(&ts[1], &vattr.va_birthtime, < ))
@@ -2952,8 +2955,6 @@
 	if ((error = getvnode(td->td_proc->p_fd, fd, &fp)) != 0)
 		return (error);
 
-	AUDIT_ARG(vnpath, fp->f_vnode, ARG_VNODE1);
-
 	if ((error = getutimes(tptr, tptrseg, ts)) != 0)
 		return (error);
 	vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount);
@@ -3061,8 +3062,6 @@
 	if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
 		return (error);
 
-	AUDIT_ARG(vnpath, fp->f_vnode, ARG_VNODE1);
-
 	if ((fp->f_flag & FWRITE) == 0) {
 		fdrop(fp, td);
 		return (EINVAL);
@@ -3073,6 +3072,7 @@
 		goto drop;
 	VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
 	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
+	AUDIT_ARG(vnpath, fp->f_vnode, ARG_VNODE1);
 	if (vp->v_type == VDIR)
 		error = EISDIR;
 #ifdef MAC
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