diff options
author | Stefan Berger <stefanb@linux.vnet.ibm.com> | 2018-06-04 16:54:54 -0400 |
---|---|---|
committer | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2018-07-18 07:27:22 -0400 |
commit | 2afd020aaeeefacb7711b47e3afb0cfb50db3f13 (patch) | |
tree | bf3a9a541f8598092f8cd7ecbfa93c0f15bc0b22 /security | |
parent | 3d2859d5d4c33b12327764b887039bca15a37e57 (diff) |
ima: Do not audit if CONFIG_INTEGRITY_AUDIT is not set
If Integrity is not auditing, IMA shouldn't audit, either.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Acked-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Diffstat (limited to 'security')
-rw-r--r-- | security/integrity/ima/Kconfig | 1 | ||||
-rw-r--r-- | security/integrity/ima/ima_policy.c | 6 | ||||
-rw-r--r-- | security/integrity/integrity.h | 15 |
3 files changed, 21 insertions, 1 deletions
diff --git a/security/integrity/ima/Kconfig b/security/integrity/ima/Kconfig index 004919d9bf09..13b446328dda 100644 --- a/security/integrity/ima/Kconfig +++ b/security/integrity/ima/Kconfig | |||
@@ -12,6 +12,7 @@ config IMA | |||
12 | select TCG_TIS if TCG_TPM && X86 | 12 | select TCG_TIS if TCG_TPM && X86 |
13 | select TCG_CRB if TCG_TPM && ACPI | 13 | select TCG_CRB if TCG_TPM && ACPI |
14 | select TCG_IBMVTPM if TCG_TPM && PPC_PSERIES | 14 | select TCG_IBMVTPM if TCG_TPM && PPC_PSERIES |
15 | select INTEGRITY_AUDIT if AUDIT | ||
15 | help | 16 | help |
16 | The Trusted Computing Group(TCG) runtime Integrity | 17 | The Trusted Computing Group(TCG) runtime Integrity |
17 | Measurement Architecture(IMA) maintains a list of hash | 18 | Measurement Architecture(IMA) maintains a list of hash |
diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c index 50ead724ba23..0178bdaa40aa 100644 --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c | |||
@@ -657,6 +657,9 @@ static int ima_lsm_rule_init(struct ima_rule_entry *entry, | |||
657 | static void ima_log_string_op(struct audit_buffer *ab, char *key, char *value, | 657 | static void ima_log_string_op(struct audit_buffer *ab, char *key, char *value, |
658 | bool (*rule_operator)(kuid_t, kuid_t)) | 658 | bool (*rule_operator)(kuid_t, kuid_t)) |
659 | { | 659 | { |
660 | if (!ab) | ||
661 | return; | ||
662 | |||
660 | if (rule_operator == &uid_gt) | 663 | if (rule_operator == &uid_gt) |
661 | audit_log_format(ab, "%s>", key); | 664 | audit_log_format(ab, "%s>", key); |
662 | else if (rule_operator == &uid_lt) | 665 | else if (rule_operator == &uid_lt) |
@@ -678,7 +681,8 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) | |||
678 | bool uid_token; | 681 | bool uid_token; |
679 | int result = 0; | 682 | int result = 0; |
680 | 683 | ||
681 | ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_INTEGRITY_RULE); | 684 | ab = integrity_audit_log_start(NULL, GFP_KERNEL, |
685 | AUDIT_INTEGRITY_RULE); | ||
682 | 686 | ||
683 | entry->uid = INVALID_UID; | 687 | entry->uid = INVALID_UID; |
684 | entry->fowner = INVALID_UID; | 688 | entry->fowner = INVALID_UID; |
diff --git a/security/integrity/integrity.h b/security/integrity/integrity.h index 0bb372eed62a..e60473b13a8d 100644 --- a/security/integrity/integrity.h +++ b/security/integrity/integrity.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/integrity.h> | 15 | #include <linux/integrity.h> |
16 | #include <crypto/sha.h> | 16 | #include <crypto/sha.h> |
17 | #include <linux/key.h> | 17 | #include <linux/key.h> |
18 | #include <linux/audit.h> | ||
18 | 19 | ||
19 | /* iint action cache flags */ | 20 | /* iint action cache flags */ |
20 | #define IMA_MEASURE 0x00000001 | 21 | #define IMA_MEASURE 0x00000001 |
@@ -199,6 +200,13 @@ static inline void evm_load_x509(void) | |||
199 | void integrity_audit_msg(int audit_msgno, struct inode *inode, | 200 | void integrity_audit_msg(int audit_msgno, struct inode *inode, |
200 | const unsigned char *fname, const char *op, | 201 | const unsigned char *fname, const char *op, |
201 | const char *cause, int result, int info); | 202 | const char *cause, int result, int info); |
203 | |||
204 | static inline struct audit_buffer * | ||
205 | integrity_audit_log_start(struct audit_context *ctx, gfp_t gfp_mask, int type) | ||
206 | { | ||
207 | return audit_log_start(ctx, gfp_mask, type); | ||
208 | } | ||
209 | |||
202 | #else | 210 | #else |
203 | static inline void integrity_audit_msg(int audit_msgno, struct inode *inode, | 211 | static inline void integrity_audit_msg(int audit_msgno, struct inode *inode, |
204 | const unsigned char *fname, | 212 | const unsigned char *fname, |
@@ -206,4 +214,11 @@ static inline void integrity_audit_msg(int audit_msgno, struct inode *inode, | |||
206 | int result, int info) | 214 | int result, int info) |
207 | { | 215 | { |
208 | } | 216 | } |
217 | |||
218 | static inline struct audit_buffer * | ||
219 | integrity_audit_log_start(struct audit_context *ctx, gfp_t gfp_mask, int type) | ||
220 | { | ||
221 | return NULL; | ||
222 | } | ||
223 | |||
209 | #endif | 224 | #endif |