summaryrefslogtreecommitdiffstats
path: root/sys/security/audit
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2012-10-22 17:50:54 +0000
committerkib <kib@FreeBSD.org>2012-10-22 17:50:54 +0000
commit560aa751e0f5cfef868bdf3fab01cdbc5169ef82 (patch)
tree6e9ef0a47c5e91d26227820c50c9767e84550821 /sys/security/audit
parentca71b68ea40c83f641d6485e027368568f244197 (diff)
downloadFreeBSD-src-560aa751e0f5cfef868bdf3fab01cdbc5169ef82.zip
FreeBSD-src-560aa751e0f5cfef868bdf3fab01cdbc5169ef82.tar.gz
Remove the support for using non-mpsafe filesystem modules.
In particular, do not lock Giant conditionally when calling into the filesystem module, remove the VFS_LOCK_GIANT() and related macros. Stop handling buffers belonging to non-mpsafe filesystems. The VFS_VERSION is bumped to indicate the interface change which does not result in the interface signatures changes. Conducted and reviewed by: attilio Tested by: pho
Diffstat (limited to 'sys/security/audit')
-rw-r--r--sys/security/audit/audit_arg.c11
-rw-r--r--sys/security/audit/audit_syscalls.c8
-rw-r--r--sys/security/audit/audit_worker.c8
3 files changed, 3 insertions, 24 deletions
diff --git a/sys/security/audit/audit_arg.c b/sys/security/audit/audit_arg.c
index e4409f2..f19375d 100644
--- a/sys/security/audit/audit_arg.c
+++ b/sys/security/audit/audit_arg.c
@@ -651,7 +651,6 @@ audit_arg_file(struct proc *p, struct file *fp)
struct socket *so;
struct inpcb *pcb;
struct vnode *vp;
- int vfslocked;
ar = currecord();
if (ar == NULL)
@@ -664,11 +663,9 @@ audit_arg_file(struct proc *p, struct file *fp)
* XXXAUDIT: Only possibly to record as first vnode?
*/
vp = fp->f_vnode;
- vfslocked = VFS_LOCK_GIANT(vp->v_mount);
vn_lock(vp, LK_SHARED | LK_RETRY);
audit_arg_vnode1(vp);
VOP_UNLOCK(vp, 0);
- VFS_UNLOCK_GIANT(vfslocked);
break;
case DTYPE_SOCKET:
@@ -768,11 +765,6 @@ audit_arg_vnode(struct vnode *vp, struct vnode_au_info *vnp)
struct vattr vattr;
int error;
- /*
- * Assume that if the caller is calling audit_arg_vnode() on a
- * non-MPSAFE vnode, then it will have acquired Giant.
- */
- VFS_ASSERT_GIANT(vp->v_mount);
ASSERT_VOP_LOCKED(vp, "audit_arg_vnode");
error = VOP_GETATTR(vp, &vattr, curthread->td_ucred);
@@ -889,7 +881,6 @@ audit_sysclose(struct thread *td, int fd)
struct kaudit_record *ar;
struct vnode *vp;
struct file *fp;
- int vfslocked;
KASSERT(td != NULL, ("audit_sysclose: td == NULL"));
@@ -903,10 +894,8 @@ audit_sysclose(struct thread *td, int fd)
return;
vp = fp->f_vnode;
- vfslocked = VFS_LOCK_GIANT(vp->v_mount);
vn_lock(vp, LK_SHARED | LK_RETRY);
audit_arg_vnode1(vp);
VOP_UNLOCK(vp, 0);
- VFS_UNLOCK_GIANT(vfslocked);
fdrop(fp, td);
}
diff --git a/sys/security/audit/audit_syscalls.c b/sys/security/audit/audit_syscalls.c
index bf60874..acf005e 100644
--- a/sys/security/audit/audit_syscalls.c
+++ b/sys/security/audit/audit_syscalls.c
@@ -749,7 +749,7 @@ sys_auditctl(struct thread *td, struct auditctl_args *uap)
struct ucred *cred;
struct vnode *vp;
int error = 0;
- int flags, vfslocked;
+ int flags;
if (jailed(td->td_ucred))
return (ENOSYS);
@@ -770,20 +770,18 @@ sys_auditctl(struct thread *td, struct auditctl_args *uap)
if (uap->path == NULL)
return (EINVAL);
- NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE | AUDITVNODE1,
+ NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1,
UIO_USERSPACE, uap->path, td);
flags = AUDIT_OPEN_FLAGS;
error = vn_open(&nd, &flags, 0, NULL);
if (error)
return (error);
- vfslocked = NDHASGIANT(&nd);
vp = nd.ni_vp;
#ifdef MAC
error = mac_system_check_auditctl(td->td_ucred, vp);
VOP_UNLOCK(vp, 0);
if (error) {
vn_close(vp, AUDIT_CLOSE_FLAGS, td->td_ucred, td);
- VFS_UNLOCK_GIANT(vfslocked);
return (error);
}
#else
@@ -792,10 +790,8 @@ sys_auditctl(struct thread *td, struct auditctl_args *uap)
NDFREE(&nd, NDF_ONLY_PNBUF);
if (vp->v_type != VREG) {
vn_close(vp, AUDIT_CLOSE_FLAGS, td->td_ucred, td);
- VFS_UNLOCK_GIANT(vfslocked);
return (EINVAL);
}
- VFS_UNLOCK_GIANT(vfslocked);
cred = td->td_ucred;
crhold(cred);
diff --git a/sys/security/audit/audit_worker.c b/sys/security/audit/audit_worker.c
index 631b29f..d21ae18 100644
--- a/sys/security/audit/audit_worker.c
+++ b/sys/security/audit/audit_worker.c
@@ -113,7 +113,7 @@ audit_record_write(struct vnode *vp, struct ucred *cred, void *data,
static struct timeval last_fail;
static int cur_lowspace_trigger;
struct statfs *mnt_stat;
- int error, vfslocked;
+ int error;
static int cur_fail;
struct vattr vattr;
long temp;
@@ -124,7 +124,6 @@ audit_record_write(struct vnode *vp, struct ucred *cred, void *data,
return;
mnt_stat = &vp->v_mount->mnt_stat;
- vfslocked = VFS_LOCK_GIANT(vp->v_mount);
/*
* First, gather statistics on the audit log file and file system so
@@ -258,7 +257,6 @@ audit_record_write(struct vnode *vp, struct ucred *cred, void *data,
}
}
- VFS_UNLOCK_GIANT(vfslocked);
return;
fail_enospc:
@@ -289,7 +287,6 @@ fail:
panic("audit_worker: write error %d\n", error);
} else if (ppsratecheck(&last_fail, &cur_fail, 1))
printf("audit_worker: write error %d\n", error);
- VFS_UNLOCK_GIANT(vfslocked);
}
/*
@@ -451,7 +448,6 @@ audit_rotate_vnode(struct ucred *cred, struct vnode *vp)
{
struct ucred *old_audit_cred;
struct vnode *old_audit_vp;
- int vfslocked;
KASSERT((cred != NULL && vp != NULL) || (cred == NULL && vp == NULL),
("audit_rotate_vnode: cred %p vp %p", cred, vp));
@@ -473,10 +469,8 @@ audit_rotate_vnode(struct ucred *cred, struct vnode *vp)
* If there was an old vnode/credential, close and free.
*/
if (old_audit_vp != NULL) {
- vfslocked = VFS_LOCK_GIANT(old_audit_vp->v_mount);
vn_close(old_audit_vp, AUDIT_CLOSE_FLAGS, old_audit_cred,
curthread);
- VFS_UNLOCK_GIANT(vfslocked);
crfree(old_audit_cred);
}
}
OpenPOWER on IntegriCloud