summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/ima_arch.c
diff options
context:
space:
mode:
authorMimi Zohar <zohar@linux.ibm.com>2019-01-27 19:03:45 -0500
committerMimi Zohar <zohar@linux.ibm.com>2019-03-27 10:36:44 -0400
commit8db5da0b8618df79eceea99672e205d4a2a6309e (patch)
tree0c2f55e5fc3827130bc7a9b389fde8c4d24261b2 /arch/x86/kernel/ima_arch.c
parent8d93e952fba216cd0811247f6360d97e0465d5fc (diff)
downloadlinux-8db5da0b8618df79eceea99672e205d4a2a6309e.tar.bz2
x86/ima: require signed kernel modules
Have the IMA architecture specific policy require signed kernel modules on systems with secure boot mode enabled; and coordinate the different signature verification methods, so only one signature is required. Requiring appended kernel module signatures may be configured, enabled on the boot command line, or with this patch enabled in secure boot mode. This patch defines set_module_sig_enforced(). To coordinate between appended kernel module signatures and IMA signatures, only define an IMA MODULE_CHECK policy rule if CONFIG_MODULE_SIG is not enabled. A custom IMA policy may still define and require an IMA signature. Signed-off-by: Mimi Zohar <zohar@linux.ibm.com> Reviewed-by: Luis Chamberlain <mcgrof@kernel.org> Acked-by: Jessica Yu <jeyu@kernel.org>
Diffstat (limited to 'arch/x86/kernel/ima_arch.c')
-rw-r--r--arch/x86/kernel/ima_arch.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/arch/x86/kernel/ima_arch.c b/arch/x86/kernel/ima_arch.c
index e47cd9390ab4..3fb9847f1cad 100644
--- a/arch/x86/kernel/ima_arch.c
+++ b/arch/x86/kernel/ima_arch.c
@@ -64,12 +64,19 @@ static const char * const sb_arch_rules[] = {
"appraise func=KEXEC_KERNEL_CHECK appraise_type=imasig",
#endif /* CONFIG_KEXEC_VERIFY_SIG */
"measure func=KEXEC_KERNEL_CHECK",
+#if !IS_ENABLED(CONFIG_MODULE_SIG)
+ "appraise func=MODULE_CHECK appraise_type=imasig",
+#endif
+ "measure func=MODULE_CHECK",
NULL
};
const char * const *arch_get_ima_policy(void)
{
- if (IS_ENABLED(CONFIG_IMA_ARCH_POLICY) && arch_ima_get_secureboot())
+ if (IS_ENABLED(CONFIG_IMA_ARCH_POLICY) && arch_ima_get_secureboot()) {
+ if (IS_ENABLED(CONFIG_MODULE_SIG))
+ set_module_sig_enforced();
return sb_arch_rules;
+ }
return NULL;
}