Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp6792506ioo; Thu, 2 Jun 2022 13:57:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2bC6EufBhemXHhC6BfMpmyCrvmDTtEey32Pp+JVhxU98gDRZi/oOTmOxmvgxYBbLXa6R/ X-Received: by 2002:a05:6402:2993:b0:42a:b25c:c9ce with SMTP id eq19-20020a056402299300b0042ab25cc9cemr7472656edb.0.1654203431204; Thu, 02 Jun 2022 13:57:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654203431; cv=none; d=google.com; s=arc-20160816; b=ni+zA7JJIts3auXJpzYIeSiPr+u2bpM28s4Ru+hnsUwgyTjgwCTJNGm8u+Xh+cHrj7 rVY+/9smj64eTSOsv5QYy5cdv/N34L6OxxQymBXLk6GAE7JOjdYKez0ckQMscjCOH9ED GnNlWkNBi/v3gtarpA2glEdj5nwTVRIZegXf+Bg9StnkqklA3IbaV7eY9pXTFlhorKEs 1z53h7WEIx6FZ/qTRFM7mSMoaKGK4gE6lLp6hlsH/kp0D6mKldpOruaMilXQfa4WI3Nm qyvfKyVP+ky70ZX7Xbq0cbTlpPBbkbC0AHRKo494nthtJ2euBy3fAnn9OGiQt4o8hSsP MNkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=f84MadzXwfRXJHsldnaCF2HgU75EE9s1Ri+xqOCswaM=; b=oDrTzHO/eHFYyCsvMNQFew+j3Cc/0oa106EtK4JU9XwZazKs9PvDXc5lMOainXZJHT 0+fs1O9IH2OsnK0M/V9zd9lOLzFJ3wVtTResvYAYePMdHhHGRaYp8KqXcUgBnY4AOYuX 22DKx5qEjTnYAa0ciPd1rAB+olcXWiWoc1ClUlUAnd0cmjzuwYDu5KIOI+5PeqAzHEUu tvMuUuN6esVr0fDPLPeRdTd+RoJ3jiWXuSE8ukuQvwA3Hqd6YhJLTNgNi9W1/1PUmQ5U 1ZbAGo8twMQQyyjx71uj4vbX7LTM/tQZpX0x5p6ROJb4R6ZF1dz/ZZGXTb+p/KQ4n/mi ZhEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=LPBRxN+d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d14-20020a056402144e00b0042b0a1bfd4esi5294517edx.343.2022.06.02.13.56.41; Thu, 02 Jun 2022 13:57:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=LPBRxN+d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238468AbiFBTPQ (ORCPT + 99 others); Thu, 2 Jun 2022 15:15:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238453AbiFBTPN (ORCPT ); Thu, 2 Jun 2022 15:15:13 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1163F21262; Thu, 2 Jun 2022 12:15:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=f84MadzXwfRXJHsldnaCF2HgU75EE9s1Ri+xqOCswaM=; b=LPBRxN+d8j76+ysX0LiMBnCTM4 ZvT5XigVClHr8a0FDuFEXXpN3Y7tyJOLK/Tc5KColEF745uhexQDo5w3si2l4WVlR7k41/ES+G4Z7 MKXVAhzLpXq4EwgcBOxF3JVyJMuam4IqqIF66OESbumg9l9cYdJhbJbET8n/TuJ/zHYbMVuelvv8f J6YHJlRulztPl22TjNnHSgchyh6xlJ8b4ihmfyy846hKgnp5crSLi91c0BZHzWtzSQ1oNJ/fVPTxw X2yi9qOIMwmMLrsOG9HyWOUWR1dp7yJLkEriNcpla62jRtOFUuD8J4IZUvJ+zQyUqlcAQlQJXihj3 mjZtooog==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nwqHa-0042tZ-2T; Thu, 02 Jun 2022 19:14:58 +0000 Date: Thu, 2 Jun 2022 12:14:58 -0700 From: Luis Chamberlain To: Saravana Kannan , Linus Torvalds Cc: Aaron Tomlin , christophe.leroy@csgroup.eu, cl@linux.com, mbenes@suse.cz, akpm@linux-foundation.org, jeyu@kernel.org, linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, void@manifault.com, atomlin@atomlin.com, allen.lkml@gmail.com, joe@perches.com, msuchanek@suse.de, oleksandr@natalenko.name, jason.wessel@windriver.com, pmladek@suse.com, daniel.thompson@linaro.org, hch@infradead.org, kernel-team@android.com Subject: Re: [PATCH v12 01/14] module: Move all into module/ Message-ID: References: <20220322140344.556474-2-atomlin@redhat.com> <20220602034111.4163292-1-saravanak@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220602034111.4163292-1-saravanak@google.com> Sender: Luis Chamberlain X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 01, 2022 at 08:41:11PM -0700, Saravana Kannan wrote: > Aaron Tomlin wrote: > > No functional changes. > > I could be mistaken, but I think this has a functional change and could > break module signature enforcement in some cases. > > > > > This patch moves all module related code into a separate directory, > > modifies each file name and creates a new Makefile. Note: this effort > > is in preparation to refactor core module code. > > > > Reviewed-by: Christophe Leroy > > Signed-off-by: Aaron Tomlin > > --- > > MAINTAINERS | 2 +- > > kernel/Makefile | 5 +---- > > kernel/module/Makefile | 12 ++++++++++++ > > kernel/{module_decompress.c => module/decompress.c} | 2 +- > > kernel/{module-internal.h => module/internal.h} | 0 > > kernel/{module.c => module/main.c} | 2 +- > > kernel/{module_signing.c => module/signing.c} | 2 +- > > I spent at least an hour trying to figure out how the code below in > module/signing.c (was moved from module/main.c in a later patch in this > series) managed to have a "module" prefix for "module.sig_enforce" kernel > cmdline param and for the /sys/module/module/parameters/sig_enforce file. > > static bool sig_enforce = IS_ENABLED(CONFIG_MODULE_SIG_FORCE); > module_param(sig_enforce, bool_enable_only, 0644); > > I thought I was missing something until I realized this was a very recent > change and might actually be a bug. If I'm not mistaken, the prefix will > now become "signing". So the kernel cmdline param would get ignore and any > userspace writes to /sys/module/module/parameters/sig_enforce will start > failing. > > I don't have a device to boot 5.19-rcX in, but I think I'm right. Can > someone confirm? > > If my code analysis is right, then the fix seems to be adding this code > before the module_param() line. > > diff --git a/kernel/module/signing.c b/kernel/module/signing.c > index 85c8999dfecf..6b0672e4417b 100644 > --- a/kernel/module/signing.c > +++ b/kernel/module/signing.c > @@ -16,6 +16,11 @@ > #include > #include "internal.h" > > +#ifdef MODULE_PARAM_PREFIX > +#undef MODULE_PARAM_PREFIX > +#endif > +#define MODULE_PARAM_PREFIX "module." > + > static bool sig_enforce = IS_ENABLED(CONFIG_MODULE_SIG_FORCE); > module_param(sig_enforce, bool_enable_only, 0644); That fix would make sense, can you send a proper patch ? The form: #ifdef MODULE_PARAM_PREFIX #undef MODULE_PARAM_PREFIX #endif #define MODULE_PARAM_PREFIX "whatever." Is surprisingly actuaclly quite common, later on we should add helper to make these more well known. Right now this is obscure tribal knowledge when splitting up files. Luis