]> xenbits.xensource.com Git - people/julieng/linux-arm.git/commitdiff
Add secure_modules() call
authorMatthew Garrett <matthew.garrett@nebula.com>
Fri, 9 Aug 2013 21:58:15 +0000 (17:58 -0400)
committerJulien Grall <julien.grall@citrix.com>
Fri, 18 Sep 2015 15:29:27 +0000 (16:29 +0100)
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
kernel/module.c

index 3a19c79918e02d37c3e77ed32a88eb9f36bb16c3..db386349cd01441711454dffb12a3151692f25b1 100644 (file)
@@ -635,6 +635,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. */
@@ -751,6 +753,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 b86b7bf1be388d72fe92fb6038b4a67b4710df1f..7f045246e1231e7eafcf5b19c898d0f67b51a664 100644 (file)
@@ -4087,3 +4087,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);