Skip to content

Commit 02523d2

Browse files
committed
Merge tag 'integrity-v6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity
Pull integrity update from Mimi Zohar: "A single commit to permit disabling IMA from the boot command line for just the kdump kernel. The exception itself sort of makes sense. My concern is that exceptions do not remain as exceptions, but somehow morph to become the norm" * tag 'integrity-v6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity: ima: add a knob ima= to allow disabling IMA in kdump kernel
2 parents 12ed593 + aa9bb1b commit 02523d2

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2212,6 +2212,11 @@
22122212
different crypto accelerators. This option can be used
22132213
to achieve best performance for particular HW.
22142214

2215+
ima= [IMA] Enable or disable IMA
2216+
Format: { "off" | "on" }
2217+
Default: "on"
2218+
Note that disabling IMA is limited to kdump kernel.
2219+
22152220
indirect_target_selection= [X86,Intel] Mitigation control for Indirect
22162221
Target Selection(ITS) bug in Intel CPUs. Updated
22172222
microcode is also required for a fix in IBPB.

security/integrity/ima/ima_main.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <linux/fs.h>
2828
#include <linux/iversion.h>
2929
#include <linux/evm.h>
30+
#include <linux/crash_dump.h>
3031

3132
#include "ima.h"
3233

@@ -38,11 +39,30 @@ int ima_appraise;
3839

3940
int __ro_after_init ima_hash_algo = HASH_ALGO_SHA1;
4041
static int hash_setup_done;
42+
static int ima_disabled __ro_after_init;
4143

4244
static struct notifier_block ima_lsm_policy_notifier = {
4345
.notifier_call = ima_lsm_policy_change,
4446
};
4547

48+
static int __init ima_setup(char *str)
49+
{
50+
if (!is_kdump_kernel()) {
51+
pr_info("Warning: ima setup option only permitted in kdump");
52+
return 1;
53+
}
54+
55+
if (strncmp(str, "off", 3) == 0)
56+
ima_disabled = 1;
57+
else if (strncmp(str, "on", 2) == 0)
58+
ima_disabled = 0;
59+
else
60+
pr_err("Invalid ima setup option: \"%s\" , please specify ima=on|off.", str);
61+
62+
return 1;
63+
}
64+
__setup("ima=", ima_setup);
65+
4666
static int __init hash_setup(char *str)
4767
{
4868
struct ima_template_desc *template_desc = ima_template_desc_current();
@@ -1186,6 +1206,12 @@ static int __init init_ima(void)
11861206
{
11871207
int error;
11881208

1209+
/*Note that turning IMA off is intentionally limited to kdump kernel.*/
1210+
if (ima_disabled && is_kdump_kernel()) {
1211+
pr_info("IMA functionality is disabled");
1212+
return 0;
1213+
}
1214+
11891215
ima_appraise_parse_cmdline();
11901216
ima_init_template_list();
11911217
hash_setup(CONFIG_IMA_DEFAULT_HASH);

0 commit comments

Comments
 (0)