aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorMimi Zohar <zohar@linux.vnet.ibm.com>2011-03-09 14:38:26 -0500
committerMimi Zohar <zohar@linux.vnet.ibm.com>2011-07-18 12:29:42 -0400
commit3e1be52d6c6b21d9080dd886c0e609e009831562 (patch)
tree2947250698b89eed0149af2d69a33b303c4d6be4 /security
parent6be5cc5246f807fd8ede9f5f1bb2826f2c598658 (diff)
security: imbed evm calls in security hooks
Imbed the evm calls evm_inode_setxattr(), evm_inode_post_setxattr(), evm_inode_removexattr() in the security hooks. evm_inode_setxattr() protects security.evm xattr. evm_inode_post_setxattr() and evm_inode_removexattr() updates the hmac associated with an inode. (Assumes an LSM module protects the setting/removing of xattr.) Changelog: - Don't define evm_verifyxattr(), unless CONFIG_INTEGRITY is enabled. - xattr_name is a 'const', value is 'void *' Signed-off-by: Mimi Zohar <zohar@us.ibm.com> Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Diffstat (limited to 'security')
-rw-r--r--security/integrity/evm/evm_main.c1
-rw-r--r--security/security.c16
2 files changed, 15 insertions, 2 deletions
diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c
index c0580dd15ec0..1746c3669c6f 100644
--- a/security/integrity/evm/evm_main.c
+++ b/security/integrity/evm/evm_main.c
@@ -18,6 +18,7 @@
18#include <linux/crypto.h> 18#include <linux/crypto.h>
19#include <linux/xattr.h> 19#include <linux/xattr.h>
20#include <linux/integrity.h> 20#include <linux/integrity.h>
21#include <linux/evm.h>
21#include "evm.h" 22#include "evm.h"
22 23
23int evm_initialized; 24int evm_initialized;
diff --git a/security/security.c b/security/security.c
index 947fdcfbc83e..21a79b3d1e8e 100644
--- a/security/security.c
+++ b/security/security.c
@@ -18,6 +18,7 @@
18#include <linux/security.h> 18#include <linux/security.h>
19#include <linux/integrity.h> 19#include <linux/integrity.h>
20#include <linux/ima.h> 20#include <linux/ima.h>
21#include <linux/evm.h>
21 22
22#define MAX_LSM_XATTR 1 23#define MAX_LSM_XATTR 1
23 24
@@ -580,9 +581,14 @@ int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry)
580int security_inode_setxattr(struct dentry *dentry, const char *name, 581int security_inode_setxattr(struct dentry *dentry, const char *name,
581 const void *value, size_t size, int flags) 582 const void *value, size_t size, int flags)
582{ 583{
584 int ret;
585
583 if (unlikely(IS_PRIVATE(dentry->d_inode))) 586 if (unlikely(IS_PRIVATE(dentry->d_inode)))
584 return 0; 587 return 0;
585 return security_ops->inode_setxattr(dentry, name, value, size, flags); 588 ret = security_ops->inode_setxattr(dentry, name, value, size, flags);
589 if (ret)
590 return ret;
591 return evm_inode_setxattr(dentry, name, value, size);
586} 592}
587 593
588void security_inode_post_setxattr(struct dentry *dentry, const char *name, 594void security_inode_post_setxattr(struct dentry *dentry, const char *name,
@@ -591,6 +597,7 @@ void security_inode_post_setxattr(struct dentry *dentry, const char *name,
591 if (unlikely(IS_PRIVATE(dentry->d_inode))) 597 if (unlikely(IS_PRIVATE(dentry->d_inode)))
592 return; 598 return;
593 security_ops->inode_post_setxattr(dentry, name, value, size, flags); 599 security_ops->inode_post_setxattr(dentry, name, value, size, flags);
600 evm_inode_post_setxattr(dentry, name, value, size);
594} 601}
595 602
596int security_inode_getxattr(struct dentry *dentry, const char *name) 603int security_inode_getxattr(struct dentry *dentry, const char *name)
@@ -609,9 +616,14 @@ int security_inode_listxattr(struct dentry *dentry)
609 616
610int security_inode_removexattr(struct dentry *dentry, const char *name) 617int security_inode_removexattr(struct dentry *dentry, const char *name)
611{ 618{
619 int ret;
620
612 if (unlikely(IS_PRIVATE(dentry->d_inode))) 621 if (unlikely(IS_PRIVATE(dentry->d_inode)))
613 return 0; 622 return 0;
614 return security_ops->inode_removexattr(dentry, name); 623 ret = security_ops->inode_removexattr(dentry, name);
624 if (ret)
625 return ret;
626 return evm_inode_removexattr(dentry, name);
615} 627}
616 628
617int security_inode_need_killpriv(struct dentry *dentry) 629int security_inode_need_killpriv(struct dentry *dentry)