]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
Add secure_modules() call
authorMatthew Garrett <matthew.garrett@nebula.com>
Fri, 9 Aug 2013 21:58:15 +0000 (17:58 -0400)
committerTim Gardner <tim.gardner@canonical.com>
Wed, 6 Apr 2016 09:29:35 +0000 (10:29 +0100)
BugLink: http://bugs.launchpad.net/bugs/1566221
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>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
include/linux/module.h
kernel/module.c

index 2bb0c308570672e7105b14f85a4215b0f9500207..ab1300986415bb47ccf42d857856e163406afab4 100644 (file)
@@ -630,6 +630,8 @@ static inline bool module_requested_async_probing(struct module *module)
        return module && module->async_probe_requested;
 }
 
+extern bool secure_modules(void);
+
 #else /* !CONFIG_MODULES... */
 
 /* Given an address, look for it in the exception tables. */
@@ -746,6 +748,10 @@ static inline bool module_requested_async_probing(struct module *module)
        return false;
 }
 
+static inline bool secure_modules(void)
+{
+       return false;
+}
 #endif /* CONFIG_MODULES */
 
 #ifdef CONFIG_SYSFS
index 9537da37ce87fe28cf11ee97d78bfa17ddc6beb3..a68cd8fa290f4bad7307a4ce02e82cc7e8bf54c2 100644 (file)
@@ -4108,3 +4108,13 @@ void module_layout(struct module *mod,
 }
 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);