From patchwork Wed Apr 22 21:55:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Luis R. Rodriguez" X-Patchwork-Id: 6258551 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 213EDBF4A6 for ; Wed, 22 Apr 2015 22:12:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0A71E202F2 for ; Wed, 22 Apr 2015 22:12:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0B411202EC for ; Wed, 22 Apr 2015 22:12:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934097AbbDVWMp (ORCPT ); Wed, 22 Apr 2015 18:12:45 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:35417 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932076AbbDVWMn (ORCPT ); Wed, 22 Apr 2015 18:12:43 -0400 Received: by pdbqd1 with SMTP id qd1so217016pdb.2; Wed, 22 Apr 2015 15:12:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=CS+EWshPQs3hGbl5lKuIGDYQvFhpAksoNXg3HJn0spU=; b=ZmegFn5vVYydetX3qkfKXTE7L25zAGoe7B2Z+LotE7TGLO3y/eZl190EvACZ+2Dxr4 4mvHbTjsq7t+rhSjgms9vSQWyh+riKR/ePYK52NL4o1E4YTcITRjWxEOkXwz8n/kivJW PufULQiDhG74Fu3eA46gAr/lpQll70VsnL27UjtJKnr/G8/DuXVmfw0V/AobBHNjV4p3 f/si791F7gX3Mqh9JC7l2t4OLTrEbv4FUOVEjZvT0Gmj6tI9/UXLLCzEbGFCuwg/l7+P HPtiUWL2VFvujw6u4pyKcP+d8nc+HHUE4PRot+RG7Ja02FXvNM3fjctisjV1FlsrGmpa YmgQ== X-Received: by 10.68.69.66 with SMTP id c2mr51480898pbu.38.1429740763379; Wed, 22 Apr 2015 15:12:43 -0700 (PDT) Received: from mcgrof@gmail.com (c-98-234-145-61.hsd1.ca.comcast.net. [98.234.145.61]) by mx.google.com with ESMTPSA id gl2sm5989093pbc.52.2015.04.22.15.12.41 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 22 Apr 2015 15:12:42 -0700 (PDT) Received: by mcgrof@gmail.com (sSMTP sendmail emulation); Wed, 22 Apr 2015 15:10:33 -0700 From: "Luis R. Rodriguez" 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" Subject: [PATCH v2 7/8] kernel/module.c: avoid ifdefs for sig_enforce declaration Date: Wed, 22 Apr 2015 14:55:10 -0700 Message-Id: <1429739711-9415-8-git-send-email-mcgrof@do-not-panic.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1429739711-9415-1-git-send-email-mcgrof@do-not-panic.com> References: <1429739711-9415-1-git-send-email-mcgrof@do-not-panic.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Luis R. Rodriguez" 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 Cc: Andrew Morton Cc: Kees Cook Cc: Tejun Heo Cc: Ingo Molnar Cc: linux-kernel@vger.kernel.org Cc: cocci@systeme.lip6.fr Signed-off-by: Luis R. Rodriguez --- 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;