diff options
author | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2011-05-13 12:53:38 -0400 |
---|---|---|
committer | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2011-07-18 12:29:50 -0400 |
commit | 817b54aa45db03437c6d09a7693fc6926eb8e822 (patch) | |
tree | 03d43f3abfbd8670e3a30a33ef868ec7705ef2c4 /security/integrity | |
parent | 7102ebcd65c1cdb5d5a87c7c5cf7a46f5afb0cac (diff) |
evm: add evm_inode_setattr to prevent updating an invalid security.evm
Permit changing of security.evm only when valid, unless in fixmode.
Reported-by: Roberto Sassu <roberto.sassu@polito.it>
Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
Diffstat (limited to 'security/integrity')
-rw-r--r-- | security/integrity/evm/evm_main.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c index 94d66af07aa4..8fc5b5d7ceaa 100644 --- a/security/integrity/evm/evm_main.c +++ b/security/integrity/evm/evm_main.c | |||
@@ -278,6 +278,21 @@ void evm_inode_post_removexattr(struct dentry *dentry, const char *xattr_name) | |||
278 | } | 278 | } |
279 | 279 | ||
280 | /** | 280 | /** |
281 | * evm_inode_setattr - prevent updating an invalid EVM extended attribute | ||
282 | * @dentry: pointer to the affected dentry | ||
283 | */ | ||
284 | int evm_inode_setattr(struct dentry *dentry, struct iattr *attr) | ||
285 | { | ||
286 | unsigned int ia_valid = attr->ia_valid; | ||
287 | enum integrity_status evm_status; | ||
288 | |||
289 | if (ia_valid & ~(ATTR_MODE | ATTR_UID | ATTR_GID)) | ||
290 | return 0; | ||
291 | evm_status = evm_verify_current_integrity(dentry); | ||
292 | return evm_status == INTEGRITY_PASS ? 0 : -EPERM; | ||
293 | } | ||
294 | |||
295 | /** | ||
281 | * evm_inode_post_setattr - update 'security.evm' after modifying metadata | 296 | * evm_inode_post_setattr - update 'security.evm' after modifying metadata |
282 | * @dentry: pointer to the affected dentry | 297 | * @dentry: pointer to the affected dentry |
283 | * @ia_valid: for the UID and GID status | 298 | * @ia_valid: for the UID and GID status |