From patchwork Thu Apr 6 19:00:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allen Webb X-Patchwork-Id: 671002 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D0CBC77B6F for ; Thu, 6 Apr 2023 19:01:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240354AbjDFTBF (ORCPT ); Thu, 6 Apr 2023 15:01:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240337AbjDFTBC (ORCPT ); Thu, 6 Apr 2023 15:01:02 -0400 Received: from mail-io1-xd49.google.com (mail-io1-xd49.google.com [IPv6:2607:f8b0:4864:20::d49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95F4359F2 for ; Thu, 6 Apr 2023 12:00:59 -0700 (PDT) Received: by mail-io1-xd49.google.com with SMTP id l7-20020a0566022dc700b0074cc9aba965so24575551iow.11 for ; Thu, 06 Apr 2023 12:00:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1680807659; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=eGQLnr57manA7/d3sSj7CWvU90h1ejgPAAwZbA4W80Y=; b=E1XOP1CaY8koFy3ME6her9rJ9Nke8XHAoAVsqLpY3lPsNoEYGcrpUF5PF5gHdN47bK NGSiShp2xcYg0DXa0KIabY1O37FSpfutYwWTjtRVrU9oHpeB9FGTYAd99a4F1/6Y8FZn AbnD5SAV+TZ0GjZP3RdKVI6rqFp6OB//JibKTs1ZBw4TBgjK4lD7u+6bQxjHMtj/gsBd BKNR9Uz/lHv1iRy4b6qhPk1HwfMVdk/ucdXhOaul/MyfX6WSdjJGRwtYds3NlIxOeBAy hYI94iBkFDpAsYZMS2B43djCX50lmE22kkHDNV9FYiOmAE1uw+MDpJDDPPsBmoU8NICk 6/qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680807659; 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=eGQLnr57manA7/d3sSj7CWvU90h1ejgPAAwZbA4W80Y=; b=tB9/KGeA+z9eF9wHvdDOvDRA4oBjPNXiiYItyo6kfVwOl306z//e3CfyWpoCMMA0Ai ioHdnT8Qn8uhj8n8Qe6BiuSYv6a7lRM49pRsa7NFrxlTPwGMDUYaU50NKDvKPX0w6Ax1 9w3PDLVIKH5jYK4qxWwUmnISpYhTEm8qxA7D14IXuL8Gb2QCs1D+OMPEWSn/ZtuBDBaP qZTpKJoMuHNTPOmT/uuipzj2Um8yO/1OTjapTgsy21QgBMJ1OjX3/7a7lqz27KkTRmuW CRuT4R3NnwKTu3Huv5BgqBy9vtdzqq1y3wNw1iuA/pcneFvnd7inQhaK9UWd2gsy19NG XyAQ== X-Gm-Message-State: AAQBX9cZ8dqZ1gowMSfRItfIfZzFBosGSs7UasFkQ9ETfeORWhovlWs4 cQACVmjXlcpRv0qh0q7eR2FeSwpv+o320lQ= X-Google-Smtp-Source: AKy350bXUyOdQnwpKnTh5pwn2Z58BJIiX3qb6NKTnyLlDlV/PWR/2NVrpWvh92/1KkRXzxoRshzXEZc+XwdEVcY= X-Received: from allenwebb.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:12e8]) (user=allenwebb job=sendgmr) by 2002:a92:1a49:0:b0:315:8f6c:50a6 with SMTP id z9-20020a921a49000000b003158f6c50a6mr6481064ill.1.1680807658940; Thu, 06 Apr 2023 12:00:58 -0700 (PDT) Date: Thu, 6 Apr 2023 14:00:20 -0500 In-Reply-To: <20230406190030.968972-1-allenwebb@google.com> Mime-Version: 1.0 References: <20221219204619.2205248-1-allenwebb@google.com> <20230406190030.968972-1-allenwebb@google.com> X-Mailer: git-send-email 2.40.0.577.gac1e443424-goog Message-ID: <20230406190030.968972-2-allenwebb@google.com> Subject: [PATCH v10 01/11] rockchip-mailbox: Remove unneeded MODULE_DEVICE_TABLE From: Allen Webb To: "linux-modules@vger.kernel.org" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" Cc: gregkh@linuxfoundation.org, mcgrof@kernel.org, christophe.leroy@csgroup.eu, nick.alcock@oracle.com, Allen Webb , kernel test robot Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org A one character difference in the name supplied to MODULE_DEVICE_TABLE breaks compilation for ROCKCHIP_MBOX after built-in modules can generate match-id based module aliases. Since this wasn't being used before and builtin aliases aren't needed in this case, remove it. This was not caught earlier because ROCKCHIP_MBOX can not be built as a module and MODULE_DEVICE_TABLE is a no-op for built-in modules. Fixes: f70ed3b5dc8b ("mailbox: rockchip: Add Rockchip mailbox driver") Reported-by: kernel test robot Link: https://lore.kernel.org/lkml/202212171140.NB93eVvI-lkp@intel.com/ Signed-off-by: Allen Webb --- drivers/mailbox/rockchip-mailbox.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/mailbox/rockchip-mailbox.c b/drivers/mailbox/rockchip-mailbox.c index e02d3c9e3693..1f0adc283d1b 100644 --- a/drivers/mailbox/rockchip-mailbox.c +++ b/drivers/mailbox/rockchip-mailbox.c @@ -159,7 +159,6 @@ static const struct of_device_id rockchip_mbox_of_match[] = { { .compatible = "rockchip,rk3368-mailbox", .data = &rk3368_drv_data}, { }, }; -MODULE_DEVICE_TABLE(of, rockchp_mbox_of_match); static int rockchip_mbox_probe(struct platform_device *pdev) { From patchwork Thu Apr 6 19:00:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allen Webb X-Patchwork-Id: 671001 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F173DC77B6C for ; Thu, 6 Apr 2023 19:01:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240333AbjDFTBK (ORCPT ); Thu, 6 Apr 2023 15:01:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239846AbjDFTBF (ORCPT ); Thu, 6 Apr 2023 15:01:05 -0400 Received: from mail-il1-x14a.google.com (mail-il1-x14a.google.com [IPv6:2607:f8b0:4864:20::14a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 774FD93CD for ; Thu, 6 Apr 2023 12:01:01 -0700 (PDT) Received: by mail-il1-x14a.google.com with SMTP id s6-20020a056e02216600b003264c778ef1so13306515ilv.23 for ; Thu, 06 Apr 2023 12:01:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1680807661; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=CIaNzDoEfkQUCUs5a1+ah5UqZ1hq5cACYGIKF90PLWA=; b=G+FTw3D1oOQIjnAKB1cpn9CiPMPKCCFM4zdri/XtQJGkhM8ftL306NfOcRuhgBJwAT +mqD0LOE5YJzkUY6ePsFoGVjZiuuVZ9E2USexjk/EUU97k0/6RzsAAanDkVOThd1NSb/ UHy8zFuNtffS3eWlDckeeAT9oCY7xDJSH2ttDYfw5Ys4YqfON7UCSPfniEHkJXIicK5X pym1+Tk0FtNI+3SFj6R7I0VHLqY1yU3s7SCpVrnruhY/CbD+oW8s5P5fV208J/K1wmOr VQqc6oZ6PtBD6O5hhHqZblnYB84HAIivUECRQzO7E8yY+rSsgFhBq+ttRv64b/8RpqGV 7E3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680807661; 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=CIaNzDoEfkQUCUs5a1+ah5UqZ1hq5cACYGIKF90PLWA=; b=DIWCPqIplZsfirKbw6e2zpf4a7iIU6/4twf1+wHH/tfKXbeiJ4LqDQez3KqIXKpSOM H2UaoO9yekNWHZwh64ECL/ws1ZAj65gdK44YXSYVFIL0hHQNEl+Oylm5Gc1a70bH+mq1 qeXYWkLb0Z82nBHaS2lSFaN+r6lmqnXE8sAuKuWRWMgnUCteSsFreS289G93wThpTcqR VKq2f/LXPrYaJ0BUV2eGZNYGJ2UpMOwASeMGXBrxScTgw5orjhCW1pdm8V5RTRlP1BxT 0UFCfR/J1TB45B4vGo01tS3SRUdCbRNowAdWSWRKUPMXAydFS2ip9mGagzoT0BFPZiLK lw7A== X-Gm-Message-State: AAQBX9dC1OqHmwR7eCPuKZPJTesUn25FePnYSpRTE1Q/UJS8EBmez9TZ 8lL1qM/xYXSf6qNtNG+Re7Jg0rO22lqvMAA= X-Google-Smtp-Source: AKy350Z+5g/pbGkfqFeQV7zALWCzNXPo9m7bN766vJbNtaAOGFM9jzMpqoRBx0ByEqTie31Zw2uJvsgSxEzqmLQ= X-Received: from allenwebb.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:12e8]) (user=allenwebb job=sendgmr) by 2002:a02:a10c:0:b0:405:8be:eaaa with SMTP id f12-20020a02a10c000000b0040508beeaaamr6056313jag.5.1680807660861; Thu, 06 Apr 2023 12:01:00 -0700 (PDT) Date: Thu, 6 Apr 2023 14:00:22 -0500 In-Reply-To: <20230406190030.968972-1-allenwebb@google.com> Mime-Version: 1.0 References: <20221219204619.2205248-1-allenwebb@google.com> <20230406190030.968972-1-allenwebb@google.com> X-Mailer: git-send-email 2.40.0.577.gac1e443424-goog Message-ID: <20230406190030.968972-4-allenwebb@google.com> Subject: [PATCH v10 03/11] stmpe-spi: Fix MODULE_DEVICE_TABLE entries From: Allen Webb To: "linux-modules@vger.kernel.org" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" Cc: gregkh@linuxfoundation.org, mcgrof@kernel.org, christophe.leroy@csgroup.eu, nick.alcock@oracle.com, Allen Webb , kernel test robot Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org A one character difference in the name supplied to MODULE_DEVICE_TABLE breaks compilation for STMPE_SPI after built-in modules can generate match-id based module aliases. Since this wasn't being used before and builtin aliases aren't needed in this case, remove it. This was not caught earlier because STMPE_SPI can not be built as a module and MODULE_DEVICE_TABLE is a no-op for built-in modules. Fixes: e789995d5c61 ("mfd: Add support for STMPE SPI interface") Reported-by: kernel test robot Link: https://lore.kernel.org/lkml/202212171140.NB93eVvI-lkp@intel.com/ Signed-off-by: Allen Webb --- drivers/mfd/stmpe-spi.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/mfd/stmpe-spi.c b/drivers/mfd/stmpe-spi.c index e9cbf33502b3..e9cb6a635472 100644 --- a/drivers/mfd/stmpe-spi.c +++ b/drivers/mfd/stmpe-spi.c @@ -129,7 +129,6 @@ static const struct spi_device_id stmpe_spi_id[] = { { "stmpe2403", STMPE2403 }, { } }; -MODULE_DEVICE_TABLE(spi, stmpe_id); static struct spi_driver stmpe_spi_driver = { .driver = { From patchwork Thu Apr 6 19:00:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allen Webb X-Patchwork-Id: 671000 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19A5EC76196 for ; Thu, 6 Apr 2023 19:01:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240417AbjDFTBa (ORCPT ); Thu, 6 Apr 2023 15:01:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240351AbjDFTBM (ORCPT ); Thu, 6 Apr 2023 15:01:12 -0400 Received: from mail-il1-x149.google.com (mail-il1-x149.google.com [IPv6:2607:f8b0:4864:20::149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD5D1975D for ; Thu, 6 Apr 2023 12:01:03 -0700 (PDT) Received: by mail-il1-x149.google.com with SMTP id s6-20020a056e02216600b003264c778ef1so13306622ilv.23 for ; Thu, 06 Apr 2023 12:01:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1680807663; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=FEZbsR+WTyUtWxubualsRcS33WiF75x8OXTLlDIM76E=; b=D81pJQDCQ+OdL291Z2IZ2aoLcZ9JSdF//vAX5266oVAnQZPAsb2ROsi95KVjKK3wKl XbpTpcSS49IV425LJMR5r61TCIqtP2EcrXEcJYbsOu8cFWo+BVrf6iH+dJ58GpAVEbGn Ob0KC9VY5azkYE4xJEOA4ueXQijtPJP+hpJhW/YwaW4aQyUwR3vMc7NqkaFbDsODU7Nw /7C7nADEmWmY3+IZXHXTYCeVpPUBnR7rp5s6E1NNNGgXR1+Bt8XYVSPcNp7Zl8/rSVHw Qsi4OfLOzlOEZEGuq+ld/NjtkVhfX4p3akpLLAcW1NwdJOuSYjjL4pHgWvhxnmu7Be9V Pzag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680807663; 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=FEZbsR+WTyUtWxubualsRcS33WiF75x8OXTLlDIM76E=; b=P2lwaaxV/0FytQh9KX4Tr8Kv6DoA9E2UcgmnCDybgereiYqJMX7wJs4vU9gpDGVNSO TUL0KcVNtr0oRyhH2HspglswHsg6MlO2Tz41o7GNBer2CJtqFk5aQf4ZIJzk1qN4RkTl ioFYUTT0omheQd/jGxA151ZytYuty8ZvcDdeeP2RQa9YMFy13xvUqi2/eb16V6xE+vAU m1jW9SBjnQr8FfuszKdOPaIA6iq7bZqt69dFg1ulhqKqdOrf/iz2YNN9HP5jasmb9fFP vd1DEP/iCOA5QTNNwXbUAQW0qxS7qXXvIZWT8SulJ9yFUiEyv/z8F6YM9BJZp+HEIYlu aoDQ== X-Gm-Message-State: AAQBX9e/jnnq5jJhLGAzUxdqM8L63h/tAtCbJiYWCmRMEnogFIQd+UEv MXCuU3cklO+427tYsTpeG5TxHeeHaDA2UnY= X-Google-Smtp-Source: AKy350bmElFuE1Xid/gxRe2zw6r7kNsu5GgybFoCIrVluA8w6qJgsdQVeebMx1wlwhideMS0TE7hnev66x532k0= X-Received: from allenwebb.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:12e8]) (user=allenwebb job=sendgmr) by 2002:a02:2a45:0:b0:406:c43f:6320 with SMTP id w66-20020a022a45000000b00406c43f6320mr4089761jaw.0.1680807662877; Thu, 06 Apr 2023 12:01:02 -0700 (PDT) Date: Thu, 6 Apr 2023 14:00:24 -0500 In-Reply-To: <20230406190030.968972-1-allenwebb@google.com> Mime-Version: 1.0 References: <20221219204619.2205248-1-allenwebb@google.com> <20230406190030.968972-1-allenwebb@google.com> X-Mailer: git-send-email 2.40.0.577.gac1e443424-goog Message-ID: <20230406190030.968972-6-allenwebb@google.com> Subject: [PATCH v10 05/11] modpost: Track module name for built-in modules From: Allen Webb To: "linux-modules@vger.kernel.org" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" Cc: gregkh@linuxfoundation.org, mcgrof@kernel.org, christophe.leroy@csgroup.eu, nick.alcock@oracle.com, Allen Webb Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Keep track of the module name when processing match table symbols. Signed-off-by: Allen Webb --- scripts/mod/file2alias.c | 39 +++++++++++++++++++++++++++++++++++---- scripts/mod/modpost.h | 1 + 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 91c2e7ba5e52..b392d51c3b06 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -28,6 +28,7 @@ typedef Elf64_Addr kernel_ulong_t; #include #endif +#include #include #include @@ -1540,9 +1541,9 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, Elf_Sym *sym, const char *symname) { void *symval; - char *zeros = NULL; - const char *name, *identifier; - unsigned int namelen; + char *zeros = NULL, *modname_str = NULL; + const char *name, *identifier, *modname; + unsigned int namelen, modnamelen; /* We're looking for a section relative symbol */ if (!sym->st_shndx || get_secindex(info, sym) >= info->num_sections) @@ -1552,7 +1553,12 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT) return; - /* All our symbols are of form __mod____device_table. */ + /* + * All our symbols are either of form + * __mod____device_table + * or + * __mod_____kmod__device_table + */ if (strncmp(symname, "__mod_", strlen("__mod_"))) return; name = symname + strlen("__mod_"); @@ -1564,8 +1570,30 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, identifier = strstr(name, "__"); if (!identifier) return; + modnamelen = namelen; namelen = identifier - name; + /* + * In the vmlinuz.o case we want to handle __kmod_ so aliases from + * builtin modules are attributed correctly. + */ + modname = strstr(identifier + 2, "__kmod_"); + if (modname) { + modname += strlen("__kmod_"); + modnamelen -= (modname - name) + strlen("_device_table"); + modname_str = malloc(modnamelen + 1); + /* We don't want to continue if the allocation fails. */ + assert(modname_str); + memcpy(modname_str, modname, modnamelen); + modname_str[modnamelen] = '\0'; + } + + if (modname_str) + modname = modname_str; + else + modname = mod->name; + mod->builtin_name = modname; + /* Handle all-NULL symbols allocated into .bss */ if (info->sechdrs[get_secindex(info, sym)].sh_type & SHT_NOBITS) { zeros = calloc(1, sym->st_size); @@ -1597,6 +1625,9 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, } } free(zeros); + mod->builtin_name = NULL; + if (modname_str) + free(modname_str); } /* Now add out buffered information to the generated C source */ diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h index 1178f40a73f3..34fe5fc0b02c 100644 --- a/scripts/mod/modpost.h +++ b/scripts/mod/modpost.h @@ -128,6 +128,7 @@ struct module { struct list_head missing_namespaces; // Actual imported namespaces struct list_head imported_namespaces; + const char *builtin_name; char name[]; }; From patchwork Thu Apr 6 19:00:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allen Webb X-Patchwork-Id: 670999 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2204C77B70 for ; Thu, 6 Apr 2023 19:01:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229825AbjDFTBg (ORCPT ); Thu, 6 Apr 2023 15:01:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240047AbjDFTBb (ORCPT ); Thu, 6 Apr 2023 15:01:31 -0400 Received: from mail-il1-x149.google.com (mail-il1-x149.google.com [IPv6:2607:f8b0:4864:20::149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BB34A260 for ; Thu, 6 Apr 2023 12:01:06 -0700 (PDT) Received: by mail-il1-x149.google.com with SMTP id i17-20020a056e020d9100b00325a80f683cso27159428ilj.22 for ; Thu, 06 Apr 2023 12:01:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1680807665; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=EIFZuvNlh3Q7f5viDBmDdFqHrpvMkDaR3sC9sXOJCEg=; b=r6Dgw36L4ye+f7TRQYGeV5tzr0btpwq3zzgs/UuXhg7VhxHkEGdn4IEj/h2PQMM8C7 9XrmV58b2OYGBa/Itz+04VD1lyNfP8oKVgBL+a+JqxD9bgvLCoGGT9xlOS7M7FSZhlrL dgPrDoQF1NMokITcEqaqE16eLq+/TyrGqoh7gwe5XUJYnNmAwK+1UyWGWYmy5FrIUyET RBrF9++/dM7QoNSpDAic5FyiBVC0USYGzK5MLgC687r/qXuqx0qG4J/VlJlQEiwErT5K pXhpKWhcW9txjXhgoS8Wh4mQInW++2qbyZT76CeylXl4fLCs7gG2hexuiYdjLRP04I53 0URw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680807665; 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=EIFZuvNlh3Q7f5viDBmDdFqHrpvMkDaR3sC9sXOJCEg=; b=k9Xdm31eqr1VPjE1SSTBgdNCGX5JtBvfM2OMb4cjJJ3ZdsPWZN3zw2I/7FzLHBDiP3 uU8IWb2bkoYSDMsnYwyoElli0j+GanPU0VzeMBWI9ndEh16j8BjAdO3/oMUyANr7Bjad /wmDD3zl/5LyiuvQy0P7+bE+peXCsKfDUsLNEeXhMiMhVU6zAOnONXjrpHASOd+W26Ks 4Ts0rX0x5D5vw0hmcbHH6eSKrj/nXVyelSnth9qLIsG/rv0fKo3KkogRp5ZasOP/VGsN MAAScbea7duyW1gWnmEn0LxGTiJpHL4ahGRhUl1bFgLv37uaTd5394CfINnKGoZClT/G tH1w== X-Gm-Message-State: AAQBX9cy/LQZhVMBdrakTOvkgoOSMnFba00jUno464MU43rlfE4CcbJD oDwJb1s/rGMzHBXA+zrlyca1sRIb4z9z8R8= X-Google-Smtp-Source: AKy350YazP6AHiQUBJHLnELBlt24GFwGrksJ3FmwYx1omjP2DXfHXKkoCpwyla4mFW8rQJlG/AJrwns8MJ8tans= X-Received: from allenwebb.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:12e8]) (user=allenwebb job=sendgmr) by 2002:a05:6e02:f44:b0:310:9afc:aa6 with SMTP id y4-20020a056e020f4400b003109afc0aa6mr6249545ilj.0.1680807665734; Thu, 06 Apr 2023 12:01:05 -0700 (PDT) Date: Thu, 6 Apr 2023 14:00:27 -0500 In-Reply-To: <20230406190030.968972-1-allenwebb@google.com> Mime-Version: 1.0 References: <20221219204619.2205248-1-allenwebb@google.com> <20230406190030.968972-1-allenwebb@google.com> X-Mailer: git-send-email 2.40.0.577.gac1e443424-goog Message-ID: <20230406190030.968972-9-allenwebb@google.com> Subject: [PATCH v10 08/11] build: Add modules.builtin.alias From: Allen Webb To: "linux-modules@vger.kernel.org" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" Cc: gregkh@linuxfoundation.org, mcgrof@kernel.org, christophe.leroy@csgroup.eu, nick.alcock@oracle.com, Allen Webb Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Generate modules.builtin.alias using modpost and install it with the modules. Signed-off-by: Allen Webb --- .gitignore | 1 + Makefile | 1 + scripts/Makefile.modpost | 15 +++++++++++++++ 3 files changed, 17 insertions(+) diff --git a/.gitignore b/.gitignore index 13a7f08a3d73..ddaa622bddac 100644 --- a/.gitignore +++ b/.gitignore @@ -71,6 +71,7 @@ modules.order /System.map /Module.markers /modules.builtin +/modules.builtin.alias /modules.builtin.modinfo /modules.nsdeps diff --git a/Makefile b/Makefile index a2c310df2145..43dcc1ea5fcf 100644 --- a/Makefile +++ b/Makefile @@ -1578,6 +1578,7 @@ __modinst_pre: fi @sed 's:^\(.*\)\.o$$:kernel/\1.ko:' modules.order > $(MODLIB)/modules.order @cp -f modules.builtin $(MODLIB)/ + @cp -f modules.builtin.alias $(MODLIB)/ @cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/ endif # CONFIG_MODULES diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 0980c58d8afc..e3ecc17a7a19 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -15,6 +15,7 @@ # 2) modpost is then used to # 3) create one .mod.c file per module # 4) create one Module.symvers file with CRC for all exported symbols +# 5) create modules.builtin.alias the aliases for built-in modules # Step 3 is used to place certain information in the module's ELF # section, including information such as: @@ -63,6 +64,20 @@ modpost-args += -T $(MODORDER) modpost-deps += $(MODORDER) endif +ifneq ($(wildcard vmlinux.o),) +output-builtin.alias := modules.builtin.alias +modpost-args += -b .modules.builtin.alias.in +.modules.builtin.alias.in: $(output-symdump) + @# Building $(output-symdump) generates .modules.builtin.alias.in as a + @# side effect. + @[ -e $@ ] || $(MODPOST) -b .modules.builtin.alias.in vmlinux.o + +$(output-builtin.alias): .modules.builtin.alias.in + sort -o $@ $^ + +__modpost: $(output-builtin.alias) +endif + ifeq ($(KBUILD_EXTMOD),) # Generate the list of in-tree objects in vmlinux From patchwork Thu Apr 6 19:00:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allen Webb X-Patchwork-Id: 670998 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A26EC76196 for ; Thu, 6 Apr 2023 19:01:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239593AbjDFTBl (ORCPT ); Thu, 6 Apr 2023 15:01:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240351AbjDFTBb (ORCPT ); Thu, 6 Apr 2023 15:01:31 -0400 Received: from mail-il1-x14a.google.com (mail-il1-x14a.google.com [IPv6:2607:f8b0:4864:20::14a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C006A5CB for ; Thu, 6 Apr 2023 12:01:07 -0700 (PDT) Received: by mail-il1-x14a.google.com with SMTP id d12-20020a056e020bec00b00325e125fbe5so26335782ilu.12 for ; Thu, 06 Apr 2023 12:01:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1680807666; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Ei4XEWjw7tArTwCoMKhp2ugctsL7jq49nRaYDRBL1Mc=; b=fbhRqzlGZlbPiWZ5IBGIy4z7rckgpL+76StH6hDf38wyBwByXbCIsFAmlVE0cVG5TK HqsTdsJmsOQJn26fMUBbDBhi697JYKpNT9cxQeU2fDWUSLG/eByrdUnKIe23vrDVZxqf ZBP1v4gu3dj1CHb/wtHjIhqoU1bMKJKU3wrEELXyN2gGsZyVLOip7UnrYagQr/ev81xN b3Bd3vKO5r1GVoi09bRFAB8/a7Y+D6JuDR595SthHnsolBMZsbGW92HOBuSfhM/J8OsN ba5cd5hdIpxcz5JXh8vvJQADy3Ad8PB/eaqfwUiX7uO/j4zE7x5OlmQhexuRZ9/HWi41 5dOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680807666; 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=Ei4XEWjw7tArTwCoMKhp2ugctsL7jq49nRaYDRBL1Mc=; b=oBH8wMOgM6LyRhZfjeR3N2S2RXDJLPH8C59D/AMA2hViQTL7vfrT9G8vNoAGiZBRna ZUb5vvUgVvNznYUwtf97oHkb6x/OMDYq2aZV0fhqNf43QD7IJi8trwbsDb2WOugS1Dlu YPKYaX6JPA7z2RwO/6Ro80/yErPtTSPb08M2CLkVDH6JpTEIqr2a+FhnUQQy67wMLrYk 3jA58sfnYe6l5VkziMpjRk1IpgZGELmrUjpCcLyQgSsFSXr3+UXUqD1B9aAEoKemc3Ra GtunOmjKLQ1KlEKD189IYHUV5TpWNba3GjnXSnKIh5He58n629cO7hCg9FmAWRwQF25/ wJvA== X-Gm-Message-State: AAQBX9dt619+s2KDXPEPopfxbgmgRY9FKbxY3xdEAG1oTkMtJvmCwtbJ HXesoTTi+n8TDViaJ5ssfZn73QHnB6GcG5A= X-Google-Smtp-Source: AKy350ZZbJ29Gs9P2JWFiLO/pUBF8z9KEDzLtRKohDDgzI4f5p+saGHIi3qNgDRvjyVBK16Y4yqOOCNY933bmd4= X-Received: from allenwebb.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:12e8]) (user=allenwebb job=sendgmr) by 2002:a02:2a45:0:b0:406:c43f:6320 with SMTP id w66-20020a022a45000000b00406c43f6320mr4089875jaw.0.1680807666582; Thu, 06 Apr 2023 12:01:06 -0700 (PDT) Date: Thu, 6 Apr 2023 14:00:28 -0500 In-Reply-To: <20230406190030.968972-1-allenwebb@google.com> Mime-Version: 1.0 References: <20221219204619.2205248-1-allenwebb@google.com> <20230406190030.968972-1-allenwebb@google.com> X-Mailer: git-send-email 2.40.0.577.gac1e443424-goog Message-ID: <20230406190030.968972-10-allenwebb@google.com> Subject: [PATCH v10 09/11] Documentation: Include modules.builtin.alias From: Allen Webb To: "linux-modules@vger.kernel.org" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" Cc: gregkh@linuxfoundation.org, mcgrof@kernel.org, christophe.leroy@csgroup.eu, nick.alcock@oracle.com, Allen Webb Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Update the documentation to include the presense and use case of modules.builtin.alias. Reviewed-by: Luis Chamberlain Signed-off-by: Allen Webb --- Documentation/kbuild/kbuild.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/kbuild/kbuild.rst b/Documentation/kbuild/kbuild.rst index 5202186728b4..b27c66c3ca9e 100644 --- a/Documentation/kbuild/kbuild.rst +++ b/Documentation/kbuild/kbuild.rst @@ -17,6 +17,13 @@ modules.builtin This file lists all modules that are built into the kernel. This is used by modprobe to not fail when trying to load something builtin. +modules.builtin.alias +--------------------- +This file lists all match-id based aliases for modules built into the kernel. +An example usage of the built-in aliases is to enable software such as +USBGuard to allow or block devices outside of just the vendor, product, and +device ID. This enables more flexible security policies in userspace. + modules.builtin.modinfo ----------------------- This file contains modinfo from all modules that are built into the kernel.