Commit fda784e5 authored by Bruno E. O. Meneguele's avatar Bruno E. O. Meneguele Committed by Mimi Zohar

module: export module signature enforcement status

A static variable sig_enforce is used as status var to indicate the real
value of CONFIG_MODULE_SIG_FORCE, once this one is set the var will hold
true, but if the CONFIG is not set the status var will hold whatever
value is present in the module.sig_enforce kernel cmdline param: true
when =1 and false when =0 or not present.

Considering this cmdline param take place over the CONFIG value when
it's not set, other places in the kernel could misbehave since they
would have only the CONFIG_MODULE_SIG_FORCE value to rely on. Exporting
this status var allows the kernel to rely in the effective value of
module signature enforcement, being it from CONFIG value or cmdline
param.
Signed-off-by: default avatarBruno E. O. Meneguele <brdeoliv@redhat.com>
Signed-off-by: default avatarMimi Zohar <zohar@linux.vnet.ibm.com>
parent ebe7c0a7
...@@ -639,6 +639,8 @@ static inline bool is_livepatch_module(struct module *mod) ...@@ -639,6 +639,8 @@ static inline bool is_livepatch_module(struct module *mod)
} }
#endif /* CONFIG_LIVEPATCH */ #endif /* CONFIG_LIVEPATCH */
bool is_module_sig_enforced(void);
#else /* !CONFIG_MODULES... */ #else /* !CONFIG_MODULES... */
static inline struct module *__module_address(unsigned long addr) static inline struct module *__module_address(unsigned long addr)
...@@ -753,6 +755,11 @@ static inline bool module_requested_async_probing(struct module *module) ...@@ -753,6 +755,11 @@ static inline bool module_requested_async_probing(struct module *module)
return false; return false;
} }
static inline bool is_module_sig_enforced(void)
{
return false;
}
#endif /* CONFIG_MODULES */ #endif /* CONFIG_MODULES */
#ifdef CONFIG_SYSFS #ifdef CONFIG_SYSFS
......
...@@ -278,6 +278,16 @@ static bool sig_enforce = IS_ENABLED(CONFIG_MODULE_SIG_FORCE); ...@@ -278,6 +278,16 @@ static bool sig_enforce = IS_ENABLED(CONFIG_MODULE_SIG_FORCE);
module_param(sig_enforce, bool_enable_only, 0644); module_param(sig_enforce, bool_enable_only, 0644);
#endif /* !CONFIG_MODULE_SIG_FORCE */ #endif /* !CONFIG_MODULE_SIG_FORCE */
/*
* Export sig_enforce kernel cmdline parameter to allow other subsystems rely
* on that instead of directly to CONFIG_MODULE_SIG_FORCE config.
*/
bool is_module_sig_enforced(void)
{
return sig_enforce;
}
EXPORT_SYMBOL(is_module_sig_enforced);
/* Block module loading/unloading? */ /* Block module loading/unloading? */
int modules_disabled = 0; int modules_disabled = 0;
core_param(nomodule, modules_disabled, bint, 0); core_param(nomodule, modules_disabled, bint, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment