Commit 0c18f29a authored by Mimi Zohar's avatar Mimi Zohar Committed by Linus Torvalds

module: limit enabling module.sig_enforce

Irrespective as to whether CONFIG_MODULE_SIG is configured, specifying
"module.sig_enforce=1" on the boot command line sets "sig_enforce".
Only allow "sig_enforce" to be set when CONFIG_MODULE_SIG is configured.

This patch makes the presence of /sys/module/module/parameters/sig_enforce
dependent on CONFIG_MODULE_SIG=y.

Fixes: fda784e5 ("module: export module signature enforcement status")
Reported-by: default avatarNayna Jain <nayna@linux.ibm.com>
Tested-by: default avatarMimi Zohar <zohar@linux.ibm.com>
Tested-by: default avatarJessica Yu <jeyu@kernel.org>
Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
Signed-off-by: default avatarJessica Yu <jeyu@kernel.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a96bfed6
...@@ -266,9 +266,18 @@ static void module_assert_mutex_or_preempt(void) ...@@ -266,9 +266,18 @@ static void module_assert_mutex_or_preempt(void)
#endif #endif
} }
#ifdef CONFIG_MODULE_SIG
static bool sig_enforce = IS_ENABLED(CONFIG_MODULE_SIG_FORCE); 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);
void set_module_sig_enforced(void)
{
sig_enforce = true;
}
#else
#define sig_enforce false
#endif
/* /*
* Export sig_enforce kernel cmdline parameter to allow other subsystems rely * Export sig_enforce kernel cmdline parameter to allow other subsystems rely
* on that instead of directly to CONFIG_MODULE_SIG_FORCE config. * on that instead of directly to CONFIG_MODULE_SIG_FORCE config.
...@@ -279,11 +288,6 @@ bool is_module_sig_enforced(void) ...@@ -279,11 +288,6 @@ bool is_module_sig_enforced(void)
} }
EXPORT_SYMBOL(is_module_sig_enforced); EXPORT_SYMBOL(is_module_sig_enforced);
void set_module_sig_enforced(void)
{
sig_enforce = true;
}
/* 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