From patchwork Mon Dec 19 20:46:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allen Webb X-Patchwork-Id: 3119 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2607342wrn; Mon, 19 Dec 2022 12:47:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXsFYoo69odsKGmoWSpr5JU1DCmJVpV4B+kYLj6QaFGZEjjYAeuzky/nO5CpT2NWKPsWM5U8 X-Received: by 2002:a05:6a21:c005:b0:af:a896:850e with SMTP id bm5-20020a056a21c00500b000afa896850emr24995697pzc.58.1671482847383; Mon, 19 Dec 2022 12:47:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671482847; cv=none; d=google.com; s=arc-20160816; b=M+zBFg3p1cswuKdpKVLztozjJObGzDN5IIZwjgduW8POE7mzAD6XOblemI5jn3po3D ls1ZQaU2s5lOxGN5soWydF47k7o69yCZ3xBJmYS6zGnFWl6Q+ZbQWE7X0LOmHLw3/8cb jSHbzMKT1ztWhzvSe3QgrS7TAuD5y0wqtiePJRYH+XAuXZxDpXm87YKgrFu0LB74rc9y AqGpqQNn7Am35QyzoJvCpiq0njv7J02FcHvn/IaRvkb4gJtV8D1npHzqh6zROfyiiNVj T4PRGGw9d30OnnNXEl+Xfpl6Ik68sxB77gDSTKdLt0eP9/OBEFLCm7LEX5OS2MRKHtAX Z9qQ== 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:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=NV6WBBu4eI6YMtgjaGT7Oej7x3xxNbQTIC5eaXZoYAk=; b=0O1JDPOv5HGq+4KKn6UwEj3OBfKydWzdBZdv5MyixEuZwuLk10S5v0FXUA6pulb7x6 tOhDugSOob6ztjFjhoqkbSq6nAqlkj7YRvZdzPzqGKWPnyjV4hLcUMVLyUSzB7MxW32r X41mF/ADvGU/SkqlbnesratUtL0YIi/dVzRpP36Ahv2M/rY4prJoJ6miiFpWGNsXfZHs QnVi2gVZZOlLmy4SbHdQCW/62qZkNhO+wg6rfGtwPhHGfVvwamh4P/TqKOZwAWuBj/ng CpIy+rDfehQOGd8os56PNmDXIa6JUb4GZsJwOO2OY0UqgbikmPPI/cRIb3IZXdpk0Yjv e2XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=W888lr4Q; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x6-20020a63fe46000000b00476b15a02cesi11696208pgj.70.2022.12.19.12.47.14; Mon, 19 Dec 2022 12:47:27 -0800 (PST) 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=W888lr4Q; 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 S232619AbiLSUq0 (ORCPT + 99 others); Mon, 19 Dec 2022 15:46:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231391AbiLSUqX (ORCPT ); Mon, 19 Dec 2022 15:46:23 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91C84120A5 for ; Mon, 19 Dec 2022 12:46:22 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id z17-20020a25e311000000b00719e04e59e1so12092488ybd.10 for ; Mon, 19 Dec 2022 12:46:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=NV6WBBu4eI6YMtgjaGT7Oej7x3xxNbQTIC5eaXZoYAk=; b=W888lr4QI2BJ31+socKSVmNlPWGpZYcjEx2iUq9OSJHUU0oIwM/GaDpUiwZufVXIhI cCzoWHFxaIDWvjs8UevdT9NYFtnP2TmOE4yEWcVIAzis58oXiIsvrjCvo5ZrsNt2Qw5R NM96KrcXx5zEJG5yDLASvX7b/eKrFVq5ZUcEs0CtLF4oi1XeZMKvIzZA3gWEw/KGFR+1 RgkOc4OUF6W83bNAcTsQp47JH31oEEkpHcdvS6gi9Z/k9By4jJAbJGALl7ngNRjU8Dx/ wC3AnzNOAHctvwsZ8R/nUJNXNDoG9G3zjttBjUrg3jTTkPam5uA28/EMs7ZaoqpYd5vS Qe/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NV6WBBu4eI6YMtgjaGT7Oej7x3xxNbQTIC5eaXZoYAk=; b=mj1IhYMt4dRYFoRam2ZT6IIcr5PCRyVqs/uEGyWjhkSfoUsIDTdwaPSXGnrFmeMrgn 3ZShM504LmiV9qVd89Rz4Re0G6+a7CGQ31vcgYMpg9NAS6JPvU8++umjFOS99fXyYWTJ sKsu27AMnVYpaJYnBN43J51Y1vrsKvNPNto4vl7cietS6PtuzT/SlGNNkDdbgx6r8yMu yDGsmkQsUWrnxSa1e0r/Amewk+VScfi2+fylY4qAcpCyS33DfM7HRgM2Q/jPnthr6EW6 e0pWQT344y44Xf2RJLBDfpCqnD19Cu3uu7wS4gVkJ50zcApoLBSGC6wX6psoxQElB3h6 +YkQ== X-Gm-Message-State: AFqh2kogWRhFSorcOEO3Tm2D9BMmbB4TJA9ZGxoeElvVPge7itKKT+m4 Np6rTzEkWAx3orN6icWYVZ1vEp6luqDqUi8= X-Received: from allenwebb.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:12e8]) (user=allenwebb job=sendgmr) by 2002:a25:ca4c:0:b0:735:b280:6964 with SMTP id a73-20020a25ca4c000000b00735b2806964mr1487492ybg.361.1671482781888; Mon, 19 Dec 2022 12:46:21 -0800 (PST) Date: Mon, 19 Dec 2022 14:46:08 -0600 In-Reply-To: <20221219191855.2010466-1-allenwebb@google.com> Mime-Version: 1.0 References: <20221219191855.2010466-1-allenwebb@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Message-ID: <20221219204619.2205248-1-allenwebb@google.com> Subject: [PATCH v9 00/10] Generate modules.builtin.alias from match ids From: Allen Webb To: "linux-modules@vger.kernel.org" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" Cc: Luis Chamberlain , Greg Kroah-Hartman , "Rafael J. Wysocki" , Allen Webb 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,USER_IN_DEF_DKIM_WL autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752410825623640981?= X-GMAIL-MSGID: =?utf-8?q?1752676798478069118?= Generate modules.builtin.alias from match ids This patch series (v8) generates `modules.builtin.alias` during modpost. The goal is for tools like USBGuard to leverage not only modules.aliases but also `modules.builtin.aliases` to associate devices with the modules that may be bound before deciding to authorize a device or not. This is particularly useful in cases when new devices of a particular type shouldn't be allowed part of the time like for lock screens. Also included in this series are added documentation, style fixes and fixes for build breakages for built-in modules that relied on MODULE_DEVICE_TABLE being a no-op. Some of these were typos in the device table name and one ifdef-ed out the device table. --- # Generate modules.builtin.alias from match ids This series (v8) adds missing `cc:stable` and `fixes:` commit tags to the relevant commits. It is unlikely these drivers were being built as modules because compilation would have failed. It also updates the build documentation to cover `modules.builtin.alias`. Note, cover letters were first added in v5. RFC (broken patch): https://lore.kernel.org/lkml/CAJzde042-M4UbpNYKw0eDVg4JqYmwmPYSsmgK+kCMTqsi+-2Yw@mail.gmail.com/ v1 (missing v1 label): https://lore.kernel.org/lkml/20221111152852.2837363-1-allenwebb@google.com/ v2 (missing v2 label): https://lore.kernel.org/lkml/20221128201332.3482092-1-allenwebb@google.com/ v3: https://lore.kernel.org/lkml/20221129224313.455862-1-allenwebb@google.com/ v4: https://lore.kernel.org/lkml/20221130221447.1202206-1-allenwebb@google.com/ v5: https://lore.kernel.org/lkml/20221201211630.101541-1-allenwebb@google.com/ v6: https://lore.kernel.org/lkml/20221202224540.1446952-1-allenwebb@google.com/ v7: https://lore.kernel.org/lkml/20221216221703.294683-1-allenwebb@google.com/ v8: https://lore.kernel.org/lkml/20221219191855.2010466-1-allenwebb@google.com/ v9: This version ## Patch series status This series is still going through revisions in response to comments. I believe there is potential to improve the Makefile part of the patch series as well as an open question of whether modpost should generate `modules.built.alias` directly or create a vmlinuz.mod.c containing the missing module info for the match-id based aliases for built-in modules. ## Acknowledgements Thanks to Greg Kroah-Hartman, Christophe Leroy, Luis Chamberlain and the other Linux maintainers for being patient with me as I have worked through learning the kernel workflow to get this series into a more presentable state. Thanks to Luis Chamberlain for raising the alternative of using kmod to address the primary motivation of the patch series. Also, thanks to Intel's kernel test robot for catching issues that showed up on different kernel configurations. Allen Webb (10): imx: Fix typo rockchip-mailbox: Fix typo scsi/BusLogic: Always include device id table stmpe-spi: Fix typo module.h: MODULE_DEVICE_TABLE for built-in modules modpost: Track module name for built-in modules modpost: Add -b option for emitting built-in aliases file2alias.c: Implement builtin.alias generation build: Add modules.builtin.alias Documentation: Include modules.builtin.alias .gitignore | 1 + Documentation/kbuild/kbuild.rst | 6 ++ Makefile | 1 + drivers/mailbox/rockchip-mailbox.c | 2 +- drivers/mfd/stmpe-spi.c | 2 +- drivers/scsi/BusLogic.c | 2 - drivers/soc/imx/imx8mp-blk-ctrl.c | 2 +- include/linux/module.h | 15 ++++- scripts/Makefile.modpost | 17 +++++- scripts/mod/file2alias.c | 94 +++++++++++++++++++++++------- scripts/mod/modpost.c | 23 +++++++- scripts/mod/modpost.h | 2 + 12 files changed, 137 insertions(+), 30 deletions(-)