@@ -248,6 +248,7 @@ enum hash_algo ima_get_hash_algo(struct evm_ima_xattr_data *xattr_value,
int xattr_len);
int ima_read_xattr(struct dentry *dentry,
struct evm_ima_xattr_data **xattr_value);
+void set_ima_appraise(char *str);
#else
static inline int ima_appraise_measurement(enum ima_hooks func,
@@ -290,6 +291,10 @@ static inline int ima_read_xattr(struct dentry *dentry,
return 0;
}
+static inline void set_ima_appraise(char *str)
+{
+}
+
#endif /* CONFIG_IMA_APPRAISE */
/* LSM based policy rules require audit */
@@ -18,15 +18,22 @@
#include "ima.h"
-static int __init default_appraise_setup(char *str)
+void set_ima_appraise(char *str)
{
-#ifdef CONFIG_IMA_APPRAISE_BOOTPARAM
if (strncmp(str, "off", 3) == 0)
ima_appraise = 0;
else if (strncmp(str, "log", 3) == 0)
ima_appraise = IMA_APPRAISE_LOG;
else if (strncmp(str, "fix", 3) == 0)
ima_appraise = IMA_APPRAISE_FIX;
+ else if (strncmp(str, "enforce", 7) == 0)
+ ima_appraise = IMA_APPRAISE_ENFORCE;
+}
+
+static int __init default_appraise_setup(char *str)
+{
+#ifdef CONFIG_IMA_APPRAISE_BOOTPARAM
+ set_ima_appraise(str);
#endif
return 1;
}
@@ -585,9 +585,12 @@ void __init ima_init_policy(void)
arch_entries = ima_init_arch_policy();
if (!arch_entries)
pr_info("No architecture policies found\n");
- else
+ else {
add_rules(arch_policy_entry, arch_entries,
IMA_DEFAULT_POLICY | IMA_CUSTOM_POLICY);
+ if (temp_ima_appraise)
+ set_ima_appraise("enforce");
+ }
/*
* Insert the builtin "secure_boot" policy rules requiring file
The "ima_appraise" mode defaults to enforcing, unless configured to allow the boot command line "ima_appraise" option. This patch explicitly sets the "ima_appraise" mode for the arch specific policy setting. Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com> --- security/integrity/ima/ima.h | 5 +++++ security/integrity/ima/ima_appraise.c | 11 +++++++++-- security/integrity/ima/ima_policy.c | 5 ++++- 3 files changed, 18 insertions(+), 3 deletions(-)