mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Garrett <matthew.garrett@nebula.com>
To: linux-security-module@vger.kernel.org
Cc: james.l.morris@oracle.com, serge@hallyn.com,
	linux-kernel@vger.kernel.org, keescook@chromium.org,
	hpa@zytor.com, gnomes@lxorguk.ukuu.org.uk,
	Matthew Garrett <matthew.garrett@nebula.com>
Subject: [PATCH 02/12] Enforce module signatures when trusted kernel is enabled
Date: Fri, 13 Mar 2015 11:38:18 -1000	[thread overview]
Message-ID: <1426282708-21485-3-git-send-email-matthew.garrett@nebula.com> (raw)
In-Reply-To: <1426282708-21485-1-git-send-email-matthew.garrett@nebula.com>

If trusted_kernel is true, require that all modules have valid signatures.

Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
---
 include/linux/module.h    | 6 ++++++
 kernel/module.c           | 6 ++++++
 security/trusted_kernel.c | 6 +++++-
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/include/linux/module.h b/include/linux/module.h
index 42999fe..1cf89e2 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -502,6 +502,8 @@ int unregister_module_notifier(struct notifier_block *nb);
 
 extern void print_modules(void);
 
+void enable_module_sig_enforce(void);
+
 #else /* !CONFIG_MODULES... */
 
 /* Given an address, look for it in the exception tables. */
@@ -612,6 +614,10 @@ static inline int unregister_module_notifier(struct notifier_block *nb)
 static inline void print_modules(void)
 {
 }
+
+static inline void enable_module_sig_enforce(void)
+{
+}
 #endif /* CONFIG_MODULES */
 
 #ifdef CONFIG_SYSFS
diff --git a/kernel/module.c b/kernel/module.c
index cc93cf6..842f58e 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -3893,3 +3893,9 @@ void module_layout(struct module *mod,
 }
 EXPORT_SYMBOL(module_layout);
 #endif
+
+void enable_module_sig_enforce(void)
+{
+	sig_enforce = true;
+}
+EXPORT_SYMBOL(enable_module_sig_enforce);
diff --git a/security/trusted_kernel.c b/security/trusted_kernel.c
index 2808113..22c4c30 100644
--- a/security/trusted_kernel.c
+++ b/security/trusted_kernel.c
@@ -11,6 +11,7 @@
 
 #include <linux/fs.h>
 #include <linux/init.h>
+#include <linux/module.h>
 #include <linux/security.h>
 #include <linux/uaccess.h>
 
@@ -29,6 +30,9 @@ int set_trusted_kernel(bool new_trusted_kernel)
 
 	trusted_kernel = new_trusted_kernel;
 
+	if (trusted_kernel == true)
+		enable_module_sig_enforce();
+
 	return 0;
 }
 EXPORT_SYMBOL(set_trusted_kernel);
@@ -105,7 +109,7 @@ late_initcall(setup_trusted_kernel);
 
 static int __init enable_trusted_kernel(char *__str)
 {
-	trusted_kernel = true;
+	set_trusted_kernel(true);
 	return 1;
 }
 __setup("trusted_kernel", enable_trusted_kernel);
-- 
2.1.0


  parent reply	other threads:[~2015-03-13 21:39 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-13 21:38 Trusted kernel patchset Matthew Garrett
2015-03-13 21:38 ` [PATCH 01/12] Add support for indicating that the booted kernel is externally trusted Matthew Garrett
2015-03-13 21:38 ` Matthew Garrett [this message]
2015-03-13 21:38 ` [PATCH 03/12] PCI: Lock down register access when trusted_kernel is true Matthew Garrett
2015-03-13 21:38 ` [PATCH 04/12] x86: Lock down IO port " Matthew Garrett
2015-03-13 21:38 ` [PATCH 05/12] Restrict /dev/mem and /dev/kmem " Matthew Garrett
2015-03-13 21:38 ` [PATCH 06/12] acpi: Limit access to custom_method if " Matthew Garrett
2015-03-13 21:38 ` [PATCH 07/12] acpi: Ignore acpi_rsdp kernel parameter when " Matthew Garrett
2015-03-13 21:38 ` [PATCH 08/12] kexec: Disable loading of unverified images Matthew Garrett
2015-03-13 21:38 ` [PATCH 09/12] uswsusp: Disable when trusted_kernel is true Matthew Garrett
2015-03-16 21:36   ` Kees Cook
2015-03-16 21:40     ` Matthew Garrett
2015-03-13 21:38 ` [PATCH 10/12] x86: Restrict MSR access " Matthew Garrett
2015-03-13 21:38 ` [PATCH 11/12] asus-wmi: Restrict debugfs interface " Matthew Garrett
2015-03-13 21:38 ` [PATCH 12/12] Add option to automatically set trusted_kernel when in Secure Boot mode Matthew Garrett
2015-04-22 11:36   ` Dan Carpenter
2015-03-15  1:53 ` Trusted kernel patchset Matthew Garrett
2015-03-16 14:45 ` One Thousand Gnomes
2015-03-16 18:15   ` Matthew Garrett
2015-03-16 20:07     ` One Thousand Gnomes
2015-03-16 20:35     ` David Lang
2015-03-16 20:57       ` One Thousand Gnomes
2015-03-16 21:11       ` Matthew Garrett
2015-03-16 21:29     ` Kees Cook
2015-03-17 17:48       ` One Thousand Gnomes
2015-03-17 20:22       ` Simon McVittie
2015-03-17 20:42         ` Matthew Garrett
2015-03-18 11:34           ` Simon McVittie
2015-03-16 21:54     ` Jiri Kosina
2015-03-18 13:24       ` joeyli
  -- strict thread matches above, loose matches on Subject: below --
2014-02-26 20:11 Trusted kernel patchset for Secure Boot lockdown Matthew Garrett
2014-02-26 20:11 ` [PATCH 02/12] Enforce module signatures when trusted kernel is enabled Matthew Garrett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1426282708-21485-3-git-send-email-matthew.garrett@nebula.com \
    --to=matthew.garrett@nebula.com \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=hpa@zytor.com \
    --cc=james.l.morris@oracle.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=serge@hallyn.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®