diff options
Diffstat (limited to 'sys/security')
| -rw-r--r-- | sys/security/mac/mac_framework.c | 22 | ||||
| -rw-r--r-- | sys/security/mac/mac_framework.h | 1 | ||||
| -rw-r--r-- | sys/security/mac/mac_internal.h | 22 | ||||
| -rw-r--r-- | sys/security/mac/mac_net.c | 22 | ||||
| -rw-r--r-- | sys/security/mac/mac_pipe.c | 22 | ||||
| -rw-r--r-- | sys/security/mac/mac_policy.h | 3 | ||||
| -rw-r--r-- | sys/security/mac/mac_process.c | 22 | ||||
| -rw-r--r-- | sys/security/mac/mac_syscalls.c | 22 | ||||
| -rw-r--r-- | sys/security/mac/mac_system.c | 22 | ||||
| -rw-r--r-- | sys/security/mac/mac_vfs.c | 22 |
10 files changed, 180 insertions, 0 deletions
diff --git a/sys/security/mac/mac_framework.c b/sys/security/mac/mac_framework.c index f80dfd6ccbab..29e5157e43b2 100644 --- a/sys/security/mac/mac_framework.c +++ b/sys/security/mac/mac_framework.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) { diff --git a/sys/security/mac/mac_framework.h b/sys/security/mac/mac_framework.h index cc4bd262e452..5c094beefca4 100644 --- a/sys/security/mac/mac_framework.h +++ b/sys/security/mac/mac_framework.h @@ -348,6 +348,7 @@ int mac_check_vnode_setutimes(struct ucred *cred, struct vnode *vp, struct timespec atime, struct timespec mtime); int mac_check_vnode_stat(struct ucred *active_cred, struct ucred *file_cred, struct vnode *vp); +int mac_check_vnode_swapon(struct ucred *cred, struct vnode *vp); int mac_check_vnode_write(struct ucred *active_cred, struct ucred *file_cred, struct vnode *vp); int mac_getsockopt_label_get(struct ucred *cred, struct socket *so, diff --git a/sys/security/mac/mac_internal.h b/sys/security/mac/mac_internal.h index f80dfd6ccbab..29e5157e43b2 100644 --- a/sys/security/mac/mac_internal.h +++ b/sys/security/mac/mac_internal.h @@ -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) { diff --git a/sys/security/mac/mac_net.c b/sys/security/mac/mac_net.c index f80dfd6ccbab..29e5157e43b2 100644 --- a/sys/security/mac/mac_net.c +++ b/sys/security/mac/mac_net.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) { diff --git a/sys/security/mac/mac_pipe.c b/sys/security/mac/mac_pipe.c index f80dfd6ccbab..29e5157e43b2 100644 --- a/sys/security/mac/mac_pipe.c +++ b/sys/security/mac/mac_pipe.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) { diff --git a/sys/security/mac/mac_policy.h b/sys/security/mac/mac_policy.h index 28ed3a85f2d3..aabc95e3e745 100644 --- a/sys/security/mac/mac_policy.h +++ b/sys/security/mac/mac_policy.h @@ -385,6 +385,8 @@ struct mac_policy_ops { int (*mpo_check_vnode_stat)(struct ucred *active_cred, struct ucred *file_cred, struct vnode *vp, struct label *label); + int (*mpo_check_vnode_swapon)(struct ucred *cred, + struct vnode *vp, struct label *label); int (*mpo_check_vnode_write)(struct ucred *active_cred, struct ucred *file_cred, struct vnode *vp, struct label *label); @@ -531,6 +533,7 @@ enum mac_op_constant { MAC_CHECK_VNODE_SETOWNER, MAC_CHECK_VNODE_SETUTIMES, MAC_CHECK_VNODE_STAT, + MAC_CHECK_VNODE_SWAPON, MAC_CHECK_VNODE_WRITE, }; diff --git a/sys/security/mac/mac_process.c b/sys/security/mac/mac_process.c index f80dfd6ccbab..29e5157e43b2 100644 --- a/sys/security/mac/mac_process.c +++ b/sys/security/mac/mac_process.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) { diff --git a/sys/security/mac/mac_syscalls.c b/sys/security/mac/mac_syscalls.c index f80dfd6ccbab..29e5157e43b2 100644 --- a/sys/security/mac/mac_syscalls.c +++ b/sys/security/mac/mac_syscalls.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) { diff --git a/sys/security/mac/mac_system.c b/sys/security/mac/mac_system.c index f80dfd6ccbab..29e5157e43b2 100644 --- a/sys/security/mac/mac_system.c +++ b/sys/security/mac/mac_system.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) { diff --git a/sys/security/mac/mac_vfs.c b/sys/security/mac/mac_vfs.c index f80dfd6ccbab..29e5157e43b2 100644 --- a/sys/security/mac/mac_vfs.c +++ b/sys/security/mac/mac_vfs.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) { |
