Skip to contentSkip to conversation

module: Allow to disable modsign in kernel cmdline

PATCH Superseded Tianjia Zhang 2 participants 3 messages Apr 28, 2020

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 module: Allow to disable modsign in kernel cmdline

This change allows to disable modsign completely at the beginning, and turn off by set the kernel cmdline no_modsig_enforce when CONFIG_MODULE_SIG_FORCE is enabled.

Yet another change allows to always show the current status of modsign through /sys/module/module/parameters/sig_enforce.

---
 kernel/module.c | 8 ++++++++
 1 file changed, 8 insertions(+)
kernel/module.c +8 -0
index 646f1e2330d2..0e68e1286377 100644
@@ -269,6 +269,14 @@ static void module_assert_mutex_or_preempt(void)
 
 static bool sig_enforce = IS_ENABLED(CONFIG_MODULE_SIG_FORCE);
 module_param(sig_enforce, bool_enable_only, 0644);
+#ifdef CONFIG_MODULE_SIG_FORCE
+static int __init set_no_modsig_enforce(char *str)
+{
+	sig_enforce = false;
+	return 1;
+}
+__setup("no_modsig_enforce", set_no_modsig_enforce);
+#endif /* !CONFIG_MODULE_SIG_FORCE */
 
 /*
  * Export sig_enforce kernel cmdline parameter to allow other subsystems rely
Signature · 1 line
2.17.1
#1 lore raw
Quoted 23 lines · Tianjia Zhang

This change allows to disable modsign completely at the beginning, and turn off by set the kernel cmdline no_modsig_enforce when CONFIG_MODULE_SIG_FORCE is enabled.

Yet another change allows to always show the current status of modsign through /sys/module/module/parameters/sig_enforce.

---
 kernel/module.c | 8 ++++++++
 1 file changed, 8 insertions(+)
kernel/module.c +1 -0
index 646f1e2330d2..0e68e1286377 100644
@@ -269,6 +269,14 @@ static void module_assert_mutex_or_preempt(void)
 
 static bool sig_enforce = IS_ENABLED(CONFIG_MODULE_SIG_FORCE);
 module_param(sig_enforce, bool_enable_only, 0644);
+#ifdef CONFIG_MODULE_SIG_FORCE

kernel/module.c static void module_assert_mutex_or_preempt(void) · line 282

Quoted 10 lines
kernel/module.c +7 -0
+static int __init set_no_modsig_enforce(char *str)
+{
+	sig_enforce = false;
+	return 1;
+}
+__setup("no_modsig_enforce", set_no_modsig_enforce);
+#endif /* !CONFIG_MODULE_SIG_FORCE */
 
 /*
  * Export sig_enforce kernel cmdline parameter to allow other subsystems rely

Hi,
Please document this cmdline option, probably in
Documentation/admin-guide/kernel-parameters.txt.

thanks.

Signature · 1 line
~Randy
#2 lore raw
Quoted 39 lines · Randy Dunlap
Quoted 23 lines · Tianjia Zhang

This change allows to disable modsign completely at the beginning, and turn off by set the kernel cmdline no_modsig_enforce when CONFIG_MODULE_SIG_FORCE is enabled.

Yet another change allows to always show the current status of modsign through /sys/module/module/parameters/sig_enforce.

---
  kernel/module.c | 8 ++++++++
  1 file changed, 8 insertions(+)
kernel/module.c +1 -0
index 646f1e2330d2..0e68e1286377 100644
@@ -269,6 +269,14 @@ static void module_assert_mutex_or_preempt(void)
 
  static bool sig_enforce = IS_ENABLED(CONFIG_MODULE_SIG_FORCE);
  module_param(sig_enforce, bool_enable_only, 0644);
+#ifdef CONFIG_MODULE_SIG_FORCE

kernel/module.c static void module_assert_mutex_or_preempt(void) · line 282

Quoted 10 lines
kernel/module.c +7 -0
+static int __init set_no_modsig_enforce(char *str)
+{
+	sig_enforce = false;
+	return 1;
+}
+__setup("no_modsig_enforce", set_no_modsig_enforce);
+#endif /* !CONFIG_MODULE_SIG_FORCE */
 
  /*
   * Export sig_enforce kernel cmdline parameter to allow other subsystems rely

Hi,
Please document this cmdline option, probably in
Documentation/admin-guide/kernel-parameters.txt.

Quoted 2 lines

thanks.

Thanks for your information, I will submit a v2 patch.

Thanks and best,
Tianjia