From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
To: rusty@rustcorp.com.au
Cc: akpm@linux-foundation.org, mingo@kernel.org, tj@kernel.org,
linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org,
keescook@chromium.org, casey@schaufler-ca.com,
cocci@systeme.lip6.fr, "Luis R. Rodriguez" <mcgrof@suse.com>
Subject: [PATCH v2 7/8] kernel/module.c: avoid ifdefs for sig_enforce declaration
Date: Wed, 22 Apr 2015 14:55:10 -0700 [thread overview]
Message-ID: <1429739711-9415-8-git-send-email-mcgrof@do-not-panic.com> (raw)
In-Reply-To: <1429739711-9415-1-git-send-email-mcgrof@do-not-panic.com>
From: "Luis R. Rodriguez" <mcgrof@suse.com>
There's no need to require an ifdef over the declaration
of sig_enforce as IS_ENABLED() can be used. While at it,
there's no harm in exposing this kernel parameter outside of
CONFIG_MODULE_SIG as it'd be a no-op on non module sig
kernels.
Now, technically we should in theory be able to remove
the #ifdef'ery over the declaration of the module parameter
as we are also trusting the bool_enable_only code for
CONFIG_MODULE_SIG kernels but for now remain paranoid
and keep it.
With time if no one can put a bullet through bool_enable_only
and if there are no technical requirements over not exposing
CONFIG_MODULE_SIG_FORCE with the measures in place by
bool_enable_only we could remove this last ifdef.
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org
Cc: cocci@systeme.lip6.fr
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
---
kernel/module.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/kernel/module.c b/kernel/module.c
index 43a1ef3..9e51b37 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -105,15 +105,10 @@ static LIST_HEAD(modules);
struct list_head *kdb_modules = &modules; /* kdb needs the list of modules */
#endif /* CONFIG_KGDB_KDB */
-#ifdef CONFIG_MODULE_SIG
-#ifdef CONFIG_MODULE_SIG_FORCE
-static bool sig_enforce = true;
-#else
-static bool sig_enforce = false;
-
+static bool sig_enforce = IS_ENABLED(CONFIG_MODULE_SIG_FORCE);
+#ifndef CONFIG_MODULE_SIG_FORCE
module_param(sig_enforce, bool_enable_only, 0644);
#endif /* !CONFIG_MODULE_SIG_FORCE */
-#endif /* CONFIG_MODULE_SIG */
/* Block module loading/unloading? */
int modules_disabled = 0;
--
2.3.2.209.gd67f9d5.dirty
next prev parent reply other threads:[~2015-04-22 22:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-22 21:55 [PATCH v2 0/8] module params: few simplifications Luis R. Rodriguez
2015-04-22 21:55 ` [PATCH v2 1/8] kernel/params: constify struct kernel_param_ops uses Luis R. Rodriguez
2015-04-22 21:55 ` [PATCH v2 2/8] kernel/module.c: use generic module param operaters for sig_enforce Luis R. Rodriguez
2015-04-22 21:55 ` [PATCH v2 3/8] kernel/params.c: generalize bool_enable_only Luis R. Rodriguez
2015-04-23 15:22 ` Tejun Heo
2015-04-23 17:00 ` Luis R. Rodriguez
2015-04-22 21:55 ` [PATCH v2 4/8] moduleparam.h: add module_param_config_*() helpers Luis R. Rodriguez
2015-04-23 2:15 ` Rusty Russell
2015-04-23 19:33 ` Luis R. Rodriguez
2015-04-22 21:55 ` [PATCH v2 5/8] kernel/workqueue.c: remove ifdefs over wq_power_efficient Luis R. Rodriguez
2015-04-22 21:55 ` [PATCH v2 6/8] kernel/workqueue.c: use module_param_config_on_off() for power_efficient Luis R. Rodriguez
2015-04-22 21:55 ` Luis R. Rodriguez [this message]
2015-04-22 21:55 ` [PATCH v2 8/8] kernel/module.c: use module_param_config_on() for sig_enforce Luis R. Rodriguez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1429739711-9415-8-git-send-email-mcgrof@do-not-panic.com \
--to=mcgrof@do-not-panic.com \
--cc=akpm@linux-foundation.org \
--cc=casey@schaufler-ca.com \
--cc=cocci@systeme.lip6.fr \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=mcgrof@suse.com \
--cc=mingo@kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).