aboutsummaryrefslogtreecommitdiffstats
path: root/security/smack
diff options
context:
space:
mode:
authorDavid Quigley <dpquigl@davequigley.com>2013-05-22 12:50:35 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2013-06-08 16:20:11 -0400
commit746df9b59c8a5f162c907796c7295d3c4c0d8995 (patch)
tree6c0e7ae018bfb33f482afdc74d0c77d6b9edd152 /security/smack
parentd47be3dfecaf20255af89a57460285c82d5271ad (diff)
Security: Add Hook to test if the particular xattr is part of a MAC model.
The interface to request security labels from user space is the xattr interface. When requesting the security label from an NFS server it is important to make sure the requested xattr actually is a MAC label. This allows us to make sure that we get the desired semantics from the attribute instead of something else such as capabilities or a time based LSM. Acked-by: Eric Paris <eparis@redhat.com> Acked-by: James Morris <james.l.morris@oracle.com> Signed-off-by: Matthew N. Dodd <Matthew.Dodd@sparta.com> Signed-off-by: Miguel Rodel Felipe <Rodel_FM@dsi.a-star.edu.sg> Signed-off-by: Phua Eu Gene <PHUA_Eu_Gene@dsi.a-star.edu.sg> Signed-off-by: Khin Mi Mi Aung <Mi_Mi_AUNG@dsi.a-star.edu.sg> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'security/smack')
-rw-r--r--security/smack/smack_lsm.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index d52c780bdb78..a7f485bb4e2e 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -3329,6 +3329,16 @@ static void smack_audit_rule_free(void *vrule)
3329#endif /* CONFIG_AUDIT */ 3329#endif /* CONFIG_AUDIT */
3330 3330
3331/** 3331/**
3332 * smack_ismaclabel - check if xattr @name references a smack MAC label
3333 * @name: Full xattr name to check.
3334 */
3335static int smack_ismaclabel(const char *name)
3336{
3337 return (strcmp(name, XATTR_SMACK_SUFFIX) == 0);
3338}
3339
3340
3341/**
3332 * smack_secid_to_secctx - return the smack label for a secid 3342 * smack_secid_to_secctx - return the smack label for a secid
3333 * @secid: incoming integer 3343 * @secid: incoming integer
3334 * @secdata: destination 3344 * @secdata: destination
@@ -3524,6 +3534,7 @@ struct security_operations smack_ops = {
3524 .audit_rule_free = smack_audit_rule_free, 3534 .audit_rule_free = smack_audit_rule_free,
3525#endif /* CONFIG_AUDIT */ 3535#endif /* CONFIG_AUDIT */
3526 3536
3537 .ismaclabel = smack_ismaclabel,
3527 .secid_to_secctx = smack_secid_to_secctx, 3538 .secid_to_secctx = smack_secid_to_secctx,
3528 .secctx_to_secid = smack_secctx_to_secid, 3539 .secctx_to_secid = smack_secctx_to_secid,
3529 .release_secctx = smack_release_secctx, 3540 .release_secctx = smack_release_secctx,