Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp6074235ioo; Wed, 1 Jun 2022 20:42:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwS9Go4WiGDMa1NLdG41R+GQgKmaF5w3PwMlti0PexGJe51XvmxMAxiA6qucAaiI0ucAqNp X-Received: by 2002:a05:6a00:8c5:b0:510:6eae:6fa1 with SMTP id s5-20020a056a0008c500b005106eae6fa1mr2828804pfu.12.1654141336446; Wed, 01 Jun 2022 20:42:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654141336; cv=none; d=google.com; s=arc-20160816; b=XUrzKaW7gQkACQrbmUjqHnCcTqI+8kubam1hW1pQL1yTto5nXLGQfd1+CeW5yPpXrb 6Q7N8lLoL/DYwWMuhEM25hCPgnR9E2/vDWOLocPQAMhuH4T3/FGHPVkVd1N2bBA/5GK2 qI7akKP0yrWVnUuqY7LGFNHmnrck4BbbpciBldd+LtHt2geQ+AQhh/r7LaNaxPi4bO/W vrZMsEQcsBevJWIagSQV+oAsuFD/yZwiBhgXnMf+7Eo9fGTFkpkoHsJWY6eWrPUy4j0F KF3+SBi4pa53ZSlzDiHA0iSUnkQwRH7Y/GYCTSC6vMH+6A2mLPcRylVoith17OHUwt0J PLUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id :in-reply-to:date:dkim-signature; bh=0TP45ri2Rm0IThufZmYq3gqP6Oy9O8gtuE5Zzf1fHAI=; b=s5QtI4MRavfHh5NVjmjzxLx4DSh/e4pLNGdGHL+/MxlQczBRCfLE1guiCD7IMNetki IsoqAkyqp1rFH18MhkMSE85w3B+N8u5XtrG52CH0Di3YtPec4+ZK+mxBJ3CNkw6J0TLA AjAvcUb8dzGwYGOWqhpaKmSlFbxUkUQY4M6QONSYJU3rsixIxjmo9+nHPBQKlUnKM0+8 +AH34DDq0O+XD4Wsfug9+hdaDr4aP6NabONCG5wezrdM2KBte5iB7UTtdylUfxCB1E65 g/DgvKfgZ2P18Zh7OIZnLRlX1pjP7yqTCdcsR/xeq2OLrp8d08Y4glJcLicnH3TkqdSi UYMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=og8WzEFi; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c2-20020a630d02000000b003c60d889162si4349279pgl.244.2022.06.01.20.42.01; Wed, 01 Jun 2022 20:42:16 -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=@google.com header.s=20210112 header.b=og8WzEFi; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229472AbiFBDlT (ORCPT + 99 others); Wed, 1 Jun 2022 23:41:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229515AbiFBDlR (ORCPT ); Wed, 1 Jun 2022 23:41:17 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B874910EA62 for ; Wed, 1 Jun 2022 20:41:15 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-30cb80ee75cso32414317b3.15 for ; Wed, 01 Jun 2022 20:41:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:subject:from:to:cc; bh=0TP45ri2Rm0IThufZmYq3gqP6Oy9O8gtuE5Zzf1fHAI=; b=og8WzEFivR8Aec/KX7BrbGLQQPelHY3Yy/jjiXxB2vK6lARri6hHWfheQdsdX6Hy6+ UHkebTYJ0qp18z95eOavjJWjeFd9wrgOTICLUx08bZLN4T+Nw7DayipbRPSPqLonsZIy LfyKCq5QkurwvGpFQ68jTCsxSbKHJ83VfcI4cTYeO/IDIro7YAbm7oWThRUJVI6Ol91e Nil3SjjT2fa8WsD30Yhyv+1YPMmAwgbv/biePE5kQRa9arJJz4TR+O6IOXN5ZCXK1+CV MfeQ8Pb9IO+WR1iAhApAHbXrerk5zm5EWLFIH5vePQiROln4wZmFC3sq7pndZ7dxbjof lt9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version:subject :from:to:cc; bh=0TP45ri2Rm0IThufZmYq3gqP6Oy9O8gtuE5Zzf1fHAI=; b=bjOcSN5UgZ5j0n80JCri9DAEDSFLe54kyRHHrmfAWL866UdXlLbk5jPPrIwaZsnS+C Y3JBqixpgaTwGTUIitPd/9sUyEz2swmkUfQRZryXjp2Vtz+SISJbkrVr73l/3V77HJT/ cg0Mc9KGHx7LqGaqL1W3EJs+WsNhhzDF8wOnpoZADVMxFGg9nXKDF4EIZ1tGxDlz6OM5 VC5U3FZiXn3nN7eCy4HPw9UwwGkPVos95c55a4J0yoEfXOKGuW+CcoQJMLG1Xn03HLIm 3feXq/854FyvEeqYYHZo9qEFLf+Q5d2A7anRYbM60HLjarv7nilyPnti3nSQmRbjztxW CFvQ== X-Gm-Message-State: AOAM532kdYrpOLhAmHvVCBl4Usj67Wt1RU+3CyxZSibPqT92DYkqnsSa n4e9am/4tzRjZruH47JRQttx3DnF2GbVyS4= X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:f3aa:cafe:c20a:e136]) (user=saravanak job=sendgmr) by 2002:a81:5512:0:b0:30c:398d:61d4 with SMTP id j18-20020a815512000000b0030c398d61d4mr3350296ywb.58.1654141274869; Wed, 01 Jun 2022 20:41:14 -0700 (PDT) Date: Wed, 1 Jun 2022 20:41:11 -0700 In-Reply-To: <20220322140344.556474-2-atomlin@redhat.com> Message-Id: <20220602034111.4163292-1-saravanak@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog Subject: Re: [PATCH v12 01/14] module: Move all into module/ From: Saravana Kannan To: Aaron Tomlin , mcgrof@kernel.org, christophe.leroy@csgroup.eu Cc: 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 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); -Saravana