aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorPaul Moore <pmoore@redhat.com>2013-07-23 17:38:38 -0400
committerEric Paris <eparis@redhat.com>2013-07-25 13:01:25 -0400
commit2e5aa86609ec1cf37bcc204fd7ba6c24c2f49fec (patch)
treedfe240f974ba5437143fa8869813ac634731d860 /include/linux
parent8bb495e3f02401ee6f76d1b1d77f3ac9f079e376 (diff)
lsm: split the xfrm_state_alloc_security() hook implementation
The xfrm_state_alloc_security() LSM hook implementation is really a multiplexed hook with two different behaviors depending on the arguments passed to it by the caller. This patch splits the LSM hook implementation into two new hook implementations, which match the LSM hooks in the rest of the kernel: * xfrm_state_alloc * xfrm_state_alloc_acquire Also included in this patch are the necessary changes to the SELinux code; no other LSMs are affected. Signed-off-by: Paul Moore <pmoore@redhat.com> Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/security.h26
1 files changed, 18 insertions, 8 deletions
diff --git a/include/linux/security.h b/include/linux/security.h
index 4686491852a7..e5a5e8a41e55 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1039,17 +1039,25 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1039 * @xfrm_policy_delete_security: 1039 * @xfrm_policy_delete_security:
1040 * @ctx contains the xfrm_sec_ctx. 1040 * @ctx contains the xfrm_sec_ctx.
1041 * Authorize deletion of xp->security. 1041 * Authorize deletion of xp->security.
1042 * @xfrm_state_alloc_security: 1042 * @xfrm_state_alloc:
1043 * @x contains the xfrm_state being added to the Security Association 1043 * @x contains the xfrm_state being added to the Security Association
1044 * Database by the XFRM system. 1044 * Database by the XFRM system.
1045 * @sec_ctx contains the security context information being provided by 1045 * @sec_ctx contains the security context information being provided by
1046 * the user-level SA generation program (e.g., setkey or racoon). 1046 * the user-level SA generation program (e.g., setkey or racoon).
1047 * @secid contains the secid from which to take the mls portion of the context.
1048 * Allocate a security structure to the x->security field; the security 1047 * Allocate a security structure to the x->security field; the security
1049 * field is initialized to NULL when the xfrm_state is allocated. Set the 1048 * field is initialized to NULL when the xfrm_state is allocated. Set the
1050 * context to correspond to either sec_ctx or polsec, with the mls portion 1049 * context to correspond to sec_ctx. Return 0 if operation was successful
1051 * taken from secid in the latter case. 1050 * (memory to allocate, legal context).
1052 * Return 0 if operation was successful (memory to allocate, legal context). 1051 * @xfrm_state_alloc_acquire:
1052 * @x contains the xfrm_state being added to the Security Association
1053 * Database by the XFRM system.
1054 * @polsec contains the policy's security context.
1055 * @secid contains the secid from which to take the mls portion of the
1056 * context.
1057 * Allocate a security structure to the x->security field; the security
1058 * field is initialized to NULL when the xfrm_state is allocated. Set the
1059 * context to correspond to secid. Return 0 if operation was successful
1060 * (memory to allocate, legal context).
1053 * @xfrm_state_free_security: 1061 * @xfrm_state_free_security:
1054 * @x contains the xfrm_state. 1062 * @x contains the xfrm_state.
1055 * Deallocate x->security. 1063 * Deallocate x->security.
@@ -1651,9 +1659,11 @@ struct security_operations {
1651 int (*xfrm_policy_clone_security) (struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctx); 1659 int (*xfrm_policy_clone_security) (struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctx);
1652 void (*xfrm_policy_free_security) (struct xfrm_sec_ctx *ctx); 1660 void (*xfrm_policy_free_security) (struct xfrm_sec_ctx *ctx);
1653 int (*xfrm_policy_delete_security) (struct xfrm_sec_ctx *ctx); 1661 int (*xfrm_policy_delete_security) (struct xfrm_sec_ctx *ctx);
1654 int (*xfrm_state_alloc_security) (struct xfrm_state *x, 1662 int (*xfrm_state_alloc) (struct xfrm_state *x,
1655 struct xfrm_user_sec_ctx *sec_ctx, 1663 struct xfrm_user_sec_ctx *sec_ctx);
1656 u32 secid); 1664 int (*xfrm_state_alloc_acquire) (struct xfrm_state *x,
1665 struct xfrm_sec_ctx *polsec,
1666 u32 secid);
1657 void (*xfrm_state_free_security) (struct xfrm_state *x); 1667 void (*xfrm_state_free_security) (struct xfrm_state *x);
1658 int (*xfrm_state_delete_security) (struct xfrm_state *x); 1668 int (*xfrm_state_delete_security) (struct xfrm_state *x);
1659 int (*xfrm_policy_lookup) (struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); 1669 int (*xfrm_policy_lookup) (struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir);