Skip to content

Commit e4d7e2d

Browse files
bmenegmimizohar
authored andcommitted
ima: limit secure boot feedback scope for appraise
Only emit an unknown/invalid message when setting the IMA appraise mode to anything other than "enforce", when secureboot is enabled. Signed-off-by: Bruno Meneguele <bmeneg@redhat.com> [zohar@linux.ibm.com: updated commit message] Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
1 parent 7fe2bb7 commit e4d7e2d

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

security/integrity/ima/ima_appraise.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,29 @@
1919
static int __init default_appraise_setup(char *str)
2020
{
2121
#ifdef CONFIG_IMA_APPRAISE_BOOTPARAM
22-
if (arch_ima_get_secureboot()) {
23-
pr_info("Secure boot enabled: ignoring ima_appraise=%s boot parameter option",
24-
str);
25-
return 1;
26-
}
22+
bool sb_state = arch_ima_get_secureboot();
23+
int appraisal_state = ima_appraise;
2724

2825
if (strncmp(str, "off", 3) == 0)
29-
ima_appraise = 0;
26+
appraisal_state = 0;
3027
else if (strncmp(str, "log", 3) == 0)
31-
ima_appraise = IMA_APPRAISE_LOG;
28+
appraisal_state = IMA_APPRAISE_LOG;
3229
else if (strncmp(str, "fix", 3) == 0)
33-
ima_appraise = IMA_APPRAISE_FIX;
30+
appraisal_state = IMA_APPRAISE_FIX;
3431
else if (strncmp(str, "enforce", 7) == 0)
35-
ima_appraise = IMA_APPRAISE_ENFORCE;
32+
appraisal_state = IMA_APPRAISE_ENFORCE;
3633
else
3734
pr_err("invalid \"%s\" appraise option", str);
35+
36+
/* If appraisal state was changed, but secure boot is enabled,
37+
* keep its default */
38+
if (sb_state) {
39+
if (!(appraisal_state & IMA_APPRAISE_ENFORCE))
40+
pr_info("Secure boot enabled: ignoring ima_appraise=%s option",
41+
str);
42+
} else {
43+
ima_appraise = appraisal_state;
44+
}
3845
#endif
3946
return 1;
4047
}

0 commit comments

Comments
 (0)