Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1724252ybg; Sat, 19 Oct 2019 01:07:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqxzw8DYy8k6X8HgQ5luucd3trLRbAUrfhq672mCYhXOLfMqgsow/V9oJqKWrQqnykmmyDqm X-Received: by 2002:a50:d615:: with SMTP id x21mr14031422edi.297.1571472462807; Sat, 19 Oct 2019 01:07:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571472462; cv=none; d=google.com; s=arc-20160816; b=Gw/DDvgVqwd0ZtXzLF/MPNFzZ8wxEBXnaI7IymiMiu6wjrrLp8qyBcvEA9q9fdT/z8 Y4O3p0RqY9LiuCGkVa+uRcjJ7DPf55CX3BbDhry4pZw/H3R77HrkTiW6PXbkF6FpFysh dW3V7aJx8qEuGlPguQHxcWv/KqUCL3l+eRR0LSAYdQb3C1xWAITrCLZlSigMVKyhMGqN DUbVh+jpu9r/+H80INL3o+qLAx4AqzuXMLqjfArXXLN1xn3cuyzVJf2nvcmILW94r643 dpk2x/msiIfAgsCW0DeQHZu515GYI3KRSOPexiWfwbd5VXJVUSndRA9amv4wV6JapI// T6XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=EbDe35gaiTVD4DdjxfTK6/lBi6D37axpnOTT3faN+u8=; b=CLtByrjAovTBXBSrjpEjbxwVlUueAOGhGZp3HddD7HKMkBlgql6KTFtLRa7rd6lw7X EO74WI7m6ST/scCDDqdWQ1PXsHsN/ViBMrXxBniIiEi/HQLKKouRRM1Q1c0d5KQUxpwX 8iQbk8VMAReCEV7CdQNJHNv3sjUe1qhJGdDi0ClsxsyHqSYKagqmSIAp+Px/4HOl0SEK DTghZTy3w97f4iW6w5vs3G0ghXH81nmsUiUWy1iIsn5Or2WqzzB6ARhTsoXecy80NISl vP3b1M+dRjVY5jbpg+mLRNLg5J09ttxLR33vhCoFGzlfmgmZ3IB/1VlbYPy7gLumlFyY ZVxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Hp4pTQtB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w6si5252513eda.336.2019.10.19.01.07.19; Sat, 19 Oct 2019 01:07:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Hp4pTQtB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S2409773AbfJRJcG (ORCPT + 99 others); Fri, 18 Oct 2019 05:32:06 -0400 Received: from mail-ua1-f74.google.com ([209.85.222.74]:39355 "EHLO mail-ua1-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2409752AbfJRJcF (ORCPT ); Fri, 18 Oct 2019 05:32:05 -0400 Received: by mail-ua1-f74.google.com with SMTP id n8so692922uak.6 for ; Fri, 18 Oct 2019 02:32:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=EbDe35gaiTVD4DdjxfTK6/lBi6D37axpnOTT3faN+u8=; b=Hp4pTQtB9H4RzTPhCrvqp4ZAYKpXP3AD+MX8LyGiDmbLYtie3H71Obdi2ZdPk48O/9 IzeOd8HzVA4+00CRvw1BKb+mEycLjYcfYT332AX/eM0g0+XWru9uSvTAg9qSk941PoBM jXlrd9JWLr4741yiIyNqAPJleZLYvOJ0VkiNTOWL6Lrkm70aCX5m2NeQhVWWY2YTiBLB QDfv9miNQSAuoU2jJSHcnv/10QlUf0PZCLoNrwTIfUQJOb0wpebDe4utZhurY7lcrgXI Qlt+/Ef2izmFl5KH2zJqpcTxDf07SNQgsLeqpZ7AZ1QMb7ZnD04agTHs/5oJxFY1Z3D8 u1gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=EbDe35gaiTVD4DdjxfTK6/lBi6D37axpnOTT3faN+u8=; b=sneQ83KxlZMCKPmh9NVtHN2pdhaxGBqcGKOBDBABkmntKC9PBlRU/FIR+JJik4ZmNh UPbYvH93hJdCMGBvJg3guudNPjuPB7/RAO87VnS1nmUT2fRNdTYnYAhjZ4tqn8eAB0iH DZTIW/O/tidxs9TGNkLpx2Yg4bApLrXgeZtnqGxwG8mKYLsub1d8c/W75PV823DRhAd6 hOX0qACt2MatBzHLG6mAN7ErJY+ue9mhSOAPfJQxrrN2/Zm52ktGAbL3E/rmtRVpRxb1 +K6y3objlAjMosMuOPhR/EGz5gOArm6wzpIqHsBSaqeez1db1+u0Ogtkxwgtsc3x9/5S d/ew== X-Gm-Message-State: APjAAAU2Pzr/0nsnMr0B0oBLylTTC2jl5CraVxKf7nGZxK25MpRZ5FUG FGXTnU0btuKmdu1ch4EqNOoN0fSyRordgeIwfys7tKHojaq2vhWm/b1suOuRy0xqkfOAS/dy6+T CJXtB9mnRk+xf/s9qB0OHRb8SxWKXtt6TeEQRlwUmBXOeTCwAFkVw42tS4B4rZ74odgsA1B0jWh U= X-Received: by 2002:a05:6122:2bb:: with SMTP id 27mr4754455vkq.66.1571391122450; Fri, 18 Oct 2019 02:32:02 -0700 (PDT) Date: Fri, 18 Oct 2019 10:31:41 +0100 In-Reply-To: <20191018093143.15997-1-maennich@google.com> Message-Id: <20191018093143.15997-3-maennich@google.com> Mime-Version: 1.0 References: <20191010151443.7399-1-maennich@google.com> <20191018093143.15997-1-maennich@google.com> X-Mailer: git-send-email 2.23.0.866.gb869b98d4c-goog Subject: [PATCH v2 2/4] modpost: make updating the symbol namespace explicit From: Matthias Maennich To: linux-kernel@vger.kernel.org Cc: kernel-team@android.com, maennich@google.com, Jessica Yu , Masahiro Yamada , Martijn Coenen , Lucas De Marchi , Shaun Ruffell , Greg Kroah-Hartman , Will Deacon , linux-kbuild@vger.kernel.org, linux-modules@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Setting the symbol namespace of a symbol within sym_add_exported feels displaced and lead to issues in the current implementation of symbol namespaces. This patch makes updating the namespace an explicit call to decouple it from adding a symbol to the export list. Acked-by: Will Deacon Reviewed-by: Greg Kroah-Hartman Reviewed-by: Masahiro Yamada Signed-off-by: Matthias Maennich --- scripts/mod/modpost.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index dbfa3997136b..95b1eac656aa 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -385,8 +385,8 @@ static void sym_update_namespace(const char *symname, const char *namespace) * Add an exported symbol - it may have already been added without a * CRC, in this case just update the CRC **/ -static struct symbol *sym_add_exported(const char *name, const char *namespace, - struct module *mod, enum export export) +static struct symbol *sym_add_exported(const char *name, struct module *mod, + enum export export) { struct symbol *s = find_symbol(name); @@ -402,7 +402,6 @@ static struct symbol *sym_add_exported(const char *name, const char *namespace, s->module = mod; } } - sym_update_namespace(name, namespace); s->preloaded = 0; s->vmlinux = is_vmlinux(mod->name); s->kernel = 0; @@ -764,7 +763,8 @@ static void handle_modversions(struct module *mod, struct elf_info *info, if (strstarts(symname, "__ksymtab_")) { name = symname + strlen("__ksymtab_"); namespace = sym_extract_namespace(&name); - sym_add_exported(name, namespace, mod, export); + sym_add_exported(name, mod, export); + sym_update_namespace(name, namespace); free(namespace); } if (strcmp(symname, "init_module") == 0) @@ -2472,12 +2472,12 @@ static void read_dump(const char *fname, unsigned int kernel) mod = new_module(modname); mod->skip = 1; } - s = sym_add_exported(symname, namespace, mod, - export_no(export)); + s = sym_add_exported(symname, mod, export_no(export)); s->kernel = kernel; s->preloaded = 1; s->is_static = 0; sym_update_crc(symname, mod, crc, export_no(export)); + sym_update_namespace(symname, namespace); } release_file(file, size); return; -- 2.23.0.866.gb869b98d4c-goog