Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1724164ybg; Sat, 19 Oct 2019 01:07:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwI2rie5KHfrbPCMep01uAq69MmNdOrMHR7QjoyhZFrmXFErFKx2CWfnQqyHNB8M/y3sgoz X-Received: by 2002:a17:906:7f04:: with SMTP id d4mr12756594ejr.178.1571472458074; Sat, 19 Oct 2019 01:07:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571472458; cv=none; d=google.com; s=arc-20160816; b=tnRTpB4QSsVW15kQ7j4vnBJ/hAAnFM6Xj4mycV9o25Jq8eJVMIlkFySdc00Pyme/LR MWZYpHP27MW/cKN1F4QUDrc1SauKQq9TRCdKuu/+GOKykbeLGy3Hi8F6GeqWqDYHLdMV 2SinE9CoXHupLwUe8UOECCjQh1HlJfimEp/8TIgxIBPWzNtCmwfCqKFkVSjFhR4c/K+V hw/rAcUTFMHJKUexF3e9TAc9pOS3D1nZLXb50QlQ5KtUolU2zFQGzr9f86+hkJHFbtE0 1zjWmHXRhLYAn2asZg50KWFSyrsmjtSwDt8Cec/DdzV359/MX7qTip+GGJXIadbm5Kk7 aryQ== 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=CefUdT/U9YxfsmGJOtKKbX2uOcNaLiHUwulgdJNO7YY=; b=OGjILK7VN7P3Pi4rwHNkrTQrDdzo2JVyHtwDJEhuVvjS4yb6rQMNWTT1HoVk26HNRw PGqy/LhxjVXPjNaxmL4H7YzDSN+lEyNwNI2m17tqRyfy3zE4WPlYwFWYEuH1+K2qbOaX WKBQuah5+qIIlGfPiu7dCcwlQwFR6ORa0UXTpOhZxj73itt+RJgXsW45nf+LWk6qC/Ai PUzyXdLwq5Z/uIlzbL5wkAjFEh692xJeJvgSEIPbpwjDLcinJub8UHXpY/ZMvFCTOHoz lBmUB2Zrw60a/N31q0uNpjcAibjMoeCkkwn1DZwct44r/ZHGwZU8xv6P5F7VlGNPT9ou +H4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="V/WZMWE+"; 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 gu8si5006592ejb.107.2019.10.19.01.07.15; Sat, 19 Oct 2019 01:07:38 -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="V/WZMWE+"; 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 S2409745AbfJRJb7 (ORCPT + 99 others); Fri, 18 Oct 2019 05:31:59 -0400 Received: from mail-wr1-f73.google.com ([209.85.221.73]:42942 "EHLO mail-wr1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392017AbfJRJb7 (ORCPT ); Fri, 18 Oct 2019 05:31:59 -0400 Received: by mail-wr1-f73.google.com with SMTP id e25so1748443wra.9 for ; Fri, 18 Oct 2019 02:31:57 -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=CefUdT/U9YxfsmGJOtKKbX2uOcNaLiHUwulgdJNO7YY=; b=V/WZMWE+vzEHrIgZiqUwjUYMEQO5dHruFItTRjoUuyxsdthMmDDFYhpqFTsyzoMbyH GlNzJ4ee8vpiXNxQCltBCH4bmXVqqGtpNSG+ZcwlFzeIGc1IvDUaELDR7EvfVM+k6hLy EVKdk47/4dAXRhDsoMO8/eHt/QcZFPWKSvxKkK7epUdVDCLITZ9w7Z1284Bj9yDmcZNp K35Z6ZE3sgX4LYOYQC2M5BrnXyB9FHIe51m/WZ8gu6oZH3aLuqKU91CFtp6ngpPlo20v VMGDLVeUZ6fGqP24sMuEJxNIPO7ZAcMJ9/fQrPmb/lwZRVDnbAXT/12T6a5JtlX7Fud6 iJIA== 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=CefUdT/U9YxfsmGJOtKKbX2uOcNaLiHUwulgdJNO7YY=; b=p9sb5Ni15Y9iIH/6Id/szGQFI6Ry/Dy1z6ztGOhDqYrHmyhTBN8D4EWWIzndr5Hkoj pij5KBedrKuzQbrZLLaRfUCgEqORHf5YEg4wbNe+PriEC96Ygfs3QZFFdtJypuK6+hVj ABlQhOt1QIPnC+yyi9cKr0Wq7iWkniemqebHMLy5rKlCwGC3gZVbyTELu4hHrsuiT76o HMBXDlyRk8oCHS+ptkBEUviJb1gnO+usJl2eCS7Ng0jVEdxwCYGYQ0k4sWMRFtP7khqc 1Jn08hzrlW3mjIYWuhRxdWpsV1zv7L9AmUBFrfo+CLOnZIqZVxM4THaLtQSSUBQPDZAw zstw== X-Gm-Message-State: APjAAAWaviczgMSCTTeE+Nq1eNWIsa25xUWpJEIZ4Re7vV/sA1o35ZRu ujtmiy4fYHPkVzRNtL63Mn4VAVR2HIR/vvyju1iBtX3f3J9XPHmwVPVFSi88032yyYJjW72CyJC K4pXFxKrc8Uwn92GKeGS+dQnH1YnXdpQWtu0Rl9veu1YKHuv5DUP99mMkEfAseKcx/Ye3QgORei M= X-Received: by 2002:adf:828c:: with SMTP id 12mr6904593wrc.40.1571391116693; Fri, 18 Oct 2019 02:31:56 -0700 (PDT) Date: Fri, 18 Oct 2019 10:31:39 +0100 In-Reply-To: <20191010151443.7399-1-maennich@google.com> Message-Id: <20191018093143.15997-1-maennich@google.com> Mime-Version: 1.0 References: <20191010151443.7399-1-maennich@google.com> X-Mailer: git-send-email 2.23.0.866.gb869b98d4c-goog Subject: [PATCH v2 0/4] export/modpost: avoid renaming __ksymtab entries for symbol namespaces 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 The introduction of the symbol namespace patches changed the way symbols are named in the ksymtab entries. That caused userland tools to fail (such as kmod's depmod). As depmod is used as part of the kernel build it was worth having another look whether this name change can be avoided. The main purpose of this series is to restore the original ksymtab entry names. For that to happen and to remove some rough edges around that, the relevant parts in modpost got a small refactoring as to when and how namespaces are evaluated and set in the symbol struct. Eventually, the namespace values can be read from __kstrtabns_ entries and their corresponding __ksymtab_strings values. That removes the need to carry the namespace names within the (anyway unique) symbol name entries. The last patch of this series is adopted from Masahiro [1]. By allowing 'no namespace' to be represented as empty string, large chunks of include/linux/export.h could be consolidated. Technically, this last patch is not absolutely necessary to fix functionality. It addresses concerns about maintainability and readability. While I strongly suggest sending all of the patches for 5.4, the last one could possible deferred to the next merge window. This patch applies to the modules-linus [2] branch. Changes since v2: - restored correct authorship for [4/4] - add missing contributor tags - fixed typos and code style (spaces/tabs) [1] https://lore.kernel.org/lkml/20190927093603.9140-5-yamada.masahiro@socionext.com/ [2] https://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux.git/log/?h=modules-linus Cc: Jessica Yu Cc: Masahiro Yamada Cc: Martijn Coenen Cc: Lucas De Marchi Cc: Shaun Ruffell Cc: Greg Kroah-Hartman Cc: Will Deacon Cc: linux-kbuild@vger.kernel.org Cc: linux-modules@vger.kernel.org Masahiro Yamada (1): export: avoid code duplication in include/linux/export.h Matthias Maennich (3): modpost: delegate updating namespaces to separate function modpost: make updating the symbol namespace explicit symbol namespaces: revert to previous __ksymtab name scheme include/linux/export.h | 97 +++++++++++++----------------------------- kernel/module.c | 2 +- scripts/mod/modpost.c | 59 ++++++++++++++++--------- scripts/mod/modpost.h | 1 + 4 files changed, 71 insertions(+), 88 deletions(-) Interdiff against v1: diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 7cf0065ac95f..0bf7eab80d9f 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -357,18 +357,21 @@ static const char *namespace_from_kstrtabns(struct elf_info *info, static void sym_update_namespace(const char *symname, const char *namespace) { - struct symbol *s = find_symbol(symname); - /* That symbol should have been created earlier and thus this is - * actually an assertion. */ - if (!s) { - merror("Could not update namespace(%s) for symbol %s\n", - namespace, symname); - return; - } - - free(s->namespace); - s->namespace = - namespace && namespace[0] ? NOFAIL(strdup(namespace)) : NULL; + struct symbol *s = find_symbol(symname); + + /* + * That symbol should have been created earlier and thus this is + * actually an assertion. + */ + if (!s) { + merror("Could not update namespace(%s) for symbol %s\n", + namespace, symname); + return; + } + + free(s->namespace); + s->namespace = + namespace && namespace[0] ? NOFAIL(strdup(namespace)) : NULL; } /** -- 2.23.0.866.gb869b98d4c-goog