summaryrefslogtreecommitdiff
path: root/sys/kern/kern_mac.c
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2002-10-22 15:53:43 +0000
committerRobert Watson <rwatson@FreeBSD.org>2002-10-22 15:53:43 +0000
commit1cbfd977fdaf8581569f097b51c4a3d8e386aa0b (patch)
tree6a24bba13df50f300ec31a1b71f9ed5936c155b5 /sys/kern/kern_mac.c
parent2789e47e2cad8f8a97023475a98de16f6d3e50fe (diff)
Notes
Diffstat (limited to 'sys/kern/kern_mac.c')
-rw-r--r--sys/kern/kern_mac.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/kern/kern_mac.c b/sys/kern/kern_mac.c
index f80dfd6ccbab..29e5157e43b2 100644
--- a/sys/kern/kern_mac.c
+++ b/sys/kern/kern_mac.c
@@ -1026,6 +1026,10 @@ mac_policy_register(struct mac_policy_conf *mpc)
mpc->mpc_ops->mpo_check_vnode_stat =
mpe->mpe_function;
break;
+ case MAC_CHECK_VNODE_SWAPON:
+ mpc->mpc_ops->mpo_check_vnode_swapon =
+ mpe->mpe_function;
+ break;
case MAC_CHECK_VNODE_WRITE:
mpc->mpc_ops->mpo_check_vnode_write =
mpe->mpe_function;
@@ -2604,6 +2608,24 @@ mac_check_vnode_stat(struct ucred *active_cred, struct ucred *file_cred,
}
int
+mac_check_vnode_swapon(struct ucred *cred, struct vnode *vp)
+{
+ int error;
+
+ ASSERT_VOP_LOCKED(vp, "mac_check_vnode_swapon");
+
+ if (!mac_enforce_fs)
+ return (0);
+
+ error = vn_refreshlabel(vp, cred);
+ if (error)
+ return (error);
+
+ MAC_CHECK(check_vnode_swapon, cred, vp, &vp->v_label);
+ return (error);
+}
+
+int
mac_check_vnode_write(struct ucred *active_cred, struct ucred *file_cred,
struct vnode *vp)
{