Skip to content

Commit 7fe2bb7

Browse files
bmenegmimizohar
authored andcommitted
integrity: invalid kernel parameters feedback
Don't silently ignore unknown or invalid ima_{policy,appraise,hash} and evm kernel boot command line options. Signed-off-by: Bruno Meneguele <bmeneg@redhat.com> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
1 parent 4afb28a commit 7fe2bb7

4 files changed

Lines changed: 16 additions & 4 deletions

File tree

security/integrity/evm/evm_main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ static int __init evm_set_fixmode(char *str)
5959
{
6060
if (strncmp(str, "fix", 3) == 0)
6161
evm_fixmode = 1;
62+
else
63+
pr_err("invalid \"%s\" mode", str);
64+
6265
return 0;
6366
}
6467
__setup("evm=", evm_set_fixmode);

security/integrity/ima/ima_appraise.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ static int __init default_appraise_setup(char *str)
3333
ima_appraise = IMA_APPRAISE_FIX;
3434
else if (strncmp(str, "enforce", 7) == 0)
3535
ima_appraise = IMA_APPRAISE_ENFORCE;
36+
else
37+
pr_err("invalid \"%s\" appraise option", str);
3638
#endif
3739
return 1;
3840
}

security/integrity/ima/ima_main.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,23 @@ static int __init hash_setup(char *str)
5050
return 1;
5151

5252
if (strcmp(template_desc->name, IMA_TEMPLATE_IMA_NAME) == 0) {
53-
if (strncmp(str, "sha1", 4) == 0)
53+
if (strncmp(str, "sha1", 4) == 0) {
5454
ima_hash_algo = HASH_ALGO_SHA1;
55-
else if (strncmp(str, "md5", 3) == 0)
55+
} else if (strncmp(str, "md5", 3) == 0) {
5656
ima_hash_algo = HASH_ALGO_MD5;
57-
else
57+
} else {
58+
pr_err("invalid hash algorithm \"%s\" for template \"%s\"",
59+
str, IMA_TEMPLATE_IMA_NAME);
5860
return 1;
61+
}
5962
goto out;
6063
}
6164

6265
i = match_string(hash_algo_name, HASH_ALGO__LAST, str);
63-
if (i < 0)
66+
if (i < 0) {
67+
pr_err("invalid hash algorithm \"%s\"", str);
6468
return 1;
69+
}
6570

6671
ima_hash_algo = i;
6772
out:

security/integrity/ima/ima_policy.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ static int __init policy_setup(char *str)
241241
ima_use_secure_boot = true;
242242
else if (strcmp(p, "fail_securely") == 0)
243243
ima_fail_unverifiable_sigs = true;
244+
else
245+
pr_err("policy \"%s\" not found", p);
244246
}
245247

246248
return 1;

0 commit comments

Comments
 (0)