History

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.

Mimi Zohar committed 7 years ago

Commit 8db5da01 parent 8d93e953 files · +18 −1Browse files

Unified · Split

3 files
  1. arch/x86/kernel/ima_arch.c +8 −1
  2. include/linux/module.h +5 −0
  3. kernel/module.c +5 −0
arch/x86/kernel/ima_arch.c+8−1
@@ -64,12 +64,19 @@ static const char * const sb_arch_rules[] = { · 63 unmodified lines
6464 "appraise func=KEXEC_KERNEL_CHECK appraise_type=imasig",
6565 #endif /* CONFIG_KEXEC_VERIFY_SIG */
6666 "measure func=KEXEC_KERNEL_CHECK",
67+#if !IS_ENABLED(CONFIG_MODULE_SIG)
68+ "appraise func=MODULE_CHECK appraise_type=imasig",
69+#endif
70+ "measure func=MODULE_CHECK",
6771 NULL
6872 };
6973
7074 const char * const *arch_get_ima_policy(void)
7175 {
72− if (IS_ENABLED(CONFIG_IMA_ARCH_POLICY) && arch_ima_get_secureboot())
76+ if (IS_ENABLED(CONFIG_IMA_ARCH_POLICY) && arch_ima_get_secureboot()) {
77+ if (IS_ENABLED(CONFIG_MODULE_SIG))
78+ set_module_sig_enforced();
7379 return sb_arch_rules;
80+ }
7481 return NULL;
7582 }
include/linux/module.h+5−0
@@ -676,6 +676,7 @@ static inline bool is_livepatch_module(struct module *mod) · 675 unmodified lines
676676 #endif /* CONFIG_LIVEPATCH */
677677
678678 bool is_module_sig_enforced(void);
679+void set_module_sig_enforced(void);
679680
680681 #else /* !CONFIG_MODULES... */
681682
@@ -796,6 +797,10 @@ static inline bool is_module_sig_enforced(void) · 114 unmodified lines
796797 return false;
797798 }
798799
800+static inline void set_module_sig_enforced(void)
801+{
802+}
803+
799804 /* Dereference module function descriptor */
800805 static inline
801806 void *dereference_module_function_descriptor(struct module *mod, void *ptr)
kernel/module.c+5−0
@@ -286,6 +286,11 @@ bool is_module_sig_enforced(void) · 285 unmodified lines
286286 }
287287 EXPORT_SYMBOL(is_module_sig_enforced);
288288
289+void set_module_sig_enforced(void)
290+{
291+ sig_enforce = true;
292+}
293+
289294 /* Block module loading/unloading? */
290295 int modules_disabled = 0;
291296 core_param(nomodule, modules_disabled, bint, 0);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t