diff options
Diffstat (limited to 'security/integrity/evm/evm_main.c')
-rw-r--r-- | security/integrity/evm/evm_main.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c index cdbde1762189..df0fa451a871 100644 --- a/security/integrity/evm/evm_main.c +++ b/security/integrity/evm/evm_main.c | |||
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/crypto.h> | 18 | #include <linux/crypto.h> |
19 | #include <linux/audit.h> | ||
19 | #include <linux/xattr.h> | 20 | #include <linux/xattr.h> |
20 | #include <linux/integrity.h> | 21 | #include <linux/integrity.h> |
21 | #include <linux/evm.h> | 22 | #include <linux/evm.h> |
@@ -24,6 +25,9 @@ | |||
24 | 25 | ||
25 | int evm_initialized; | 26 | int evm_initialized; |
26 | 27 | ||
28 | static char *integrity_status_msg[] = { | ||
29 | "pass", "fail", "no_label", "no_xattrs", "unknown" | ||
30 | }; | ||
27 | char *evm_hmac = "hmac(sha1)"; | 31 | char *evm_hmac = "hmac(sha1)"; |
28 | char *evm_hash = "sha1"; | 32 | char *evm_hash = "sha1"; |
29 | int evm_hmac_version = CONFIG_EVM_HMAC_VERSION; | 33 | int evm_hmac_version = CONFIG_EVM_HMAC_VERSION; |
@@ -262,9 +266,15 @@ static int evm_protect_xattr(struct dentry *dentry, const char *xattr_name, | |||
262 | if ((evm_status == INTEGRITY_PASS) || | 266 | if ((evm_status == INTEGRITY_PASS) || |
263 | (evm_status == INTEGRITY_NOXATTRS)) | 267 | (evm_status == INTEGRITY_NOXATTRS)) |
264 | return 0; | 268 | return 0; |
265 | return -EPERM; | 269 | goto out; |
266 | } | 270 | } |
267 | evm_status = evm_verify_current_integrity(dentry); | 271 | evm_status = evm_verify_current_integrity(dentry); |
272 | out: | ||
273 | if (evm_status != INTEGRITY_PASS) | ||
274 | integrity_audit_msg(AUDIT_INTEGRITY_METADATA, dentry->d_inode, | ||
275 | dentry->d_name.name, "appraise_metadata", | ||
276 | integrity_status_msg[evm_status], | ||
277 | -EPERM, 0); | ||
268 | return evm_status == INTEGRITY_PASS ? 0 : -EPERM; | 278 | return evm_status == INTEGRITY_PASS ? 0 : -EPERM; |
269 | } | 279 | } |
270 | 280 | ||
@@ -357,6 +367,9 @@ int evm_inode_setattr(struct dentry *dentry, struct iattr *attr) | |||
357 | if ((evm_status == INTEGRITY_PASS) || | 367 | if ((evm_status == INTEGRITY_PASS) || |
358 | (evm_status == INTEGRITY_NOXATTRS)) | 368 | (evm_status == INTEGRITY_NOXATTRS)) |
359 | return 0; | 369 | return 0; |
370 | integrity_audit_msg(AUDIT_INTEGRITY_METADATA, dentry->d_inode, | ||
371 | dentry->d_name.name, "appraise_metadata", | ||
372 | integrity_status_msg[evm_status], -EPERM, 0); | ||
360 | return -EPERM; | 373 | return -EPERM; |
361 | } | 374 | } |
362 | 375 | ||