[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1429739711-9415-8-git-send-email-mcgrof@do-not-panic.com>
Date: Wed, 22 Apr 2015 14:55:10 -0700
From: "Luis R. Rodriguez" <mcgrof@...not-panic.com>
To: rusty@...tcorp.com.au
Cc: akpm@...ux-foundation.org, mingo@...nel.org, tj@...nel.org,
linux-kernel@...r.kernel.org, linux-wireless@...r.kernel.org,
keescook@...omium.org, casey@...aufler-ca.com,
cocci@...teme.lip6.fr, "Luis R. Rodriguez" <mcgrof@...e.com>
Subject: [PATCH v2 7/8] kernel/module.c: avoid ifdefs for sig_enforce declaration
From: "Luis R. Rodriguez" <mcgrof@...e.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@...tcorp.com.au>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Kees Cook <keescook@...omium.org>
Cc: Tejun Heo <tj@...nel.org>
Cc: Ingo Molnar <mingo@...nel.org>
Cc: linux-kernel@...r.kernel.org
Cc: cocci@...teme.lip6.fr
Signed-off-by: Luis R. Rodriguez <mcgrof@...e.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists