2014-08-20 17:22:24 +00:00
|
|
|
From: Matthew Garrett <matthew.garrett@nebula.com>
|
|
|
|
Date: Fri, 9 Aug 2013 17:58:15 -0400
|
|
|
|
Subject: [PATCH] Add secure_modules() call
|
|
|
|
|
|
|
|
Provide a single call to allow kernel code to determine whether the system
|
|
|
|
has been configured to either disable module loading entirely or to load
|
|
|
|
only modules signed with a trusted key.
|
|
|
|
|
|
|
|
Bugzilla: N/A
|
|
|
|
Upstream-status: Fedora mustard. Replaced by securelevels, but that was nak'd
|
|
|
|
|
|
|
|
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
|
|
|
|
---
|
|
|
|
include/linux/module.h | 7 +++++++
|
|
|
|
kernel/module.c | 10 ++++++++++
|
|
|
|
2 files changed, 17 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/include/linux/module.h b/include/linux/module.h
|
2015-02-16 15:01:09 +00:00
|
|
|
index 42999fe2dbd0..0c86ec9e10ed 100644
|
2014-08-20 17:22:24 +00:00
|
|
|
--- a/include/linux/module.h
|
|
|
|
+++ b/include/linux/module.h
|
2015-01-05 21:09:49 +00:00
|
|
|
@@ -502,6 +502,8 @@ int unregister_module_notifier(struct notifier_block *nb);
|
2014-08-20 17:22:24 +00:00
|
|
|
|
|
|
|
extern void print_modules(void);
|
|
|
|
|
|
|
|
+extern bool secure_modules(void);
|
|
|
|
+
|
|
|
|
#else /* !CONFIG_MODULES... */
|
|
|
|
|
|
|
|
/* Given an address, look for it in the exception tables. */
|
2015-01-05 21:09:49 +00:00
|
|
|
@@ -612,6 +614,11 @@ static inline int unregister_module_notifier(struct notifier_block *nb)
|
2014-08-20 17:22:24 +00:00
|
|
|
static inline void print_modules(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+static inline bool secure_modules(void)
|
|
|
|
+{
|
|
|
|
+ return false;
|
|
|
|
+}
|
|
|
|
#endif /* CONFIG_MODULES */
|
|
|
|
|
|
|
|
#ifdef CONFIG_SYSFS
|
|
|
|
diff --git a/kernel/module.c b/kernel/module.c
|
2015-02-18 21:50:20 +00:00
|
|
|
index b34813f725e9..f6e8beef7b1e 100644
|
2014-08-20 17:22:24 +00:00
|
|
|
--- a/kernel/module.c
|
|
|
|
+++ b/kernel/module.c
|
2015-02-18 21:50:20 +00:00
|
|
|
@@ -3891,3 +3891,13 @@ void module_layout(struct module *mod,
|
2014-08-20 17:22:24 +00:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(module_layout);
|
|
|
|
#endif
|
|
|
|
+
|
|
|
|
+bool secure_modules(void)
|
|
|
|
+{
|
|
|
|
+#ifdef CONFIG_MODULE_SIG
|
|
|
|
+ return (sig_enforce || modules_disabled);
|
|
|
|
+#else
|
|
|
|
+ return modules_disabled;
|
|
|
|
+#endif
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL(secure_modules);
|
|
|
|
--
|
2014-12-09 14:25:39 +00:00
|
|
|
2.1.0
|
2014-08-20 17:22:24 +00:00
|
|
|
|