linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthias Maennich <maennich@google.com>
To: linux-kernel@vger.kernel.org
Cc: kernel-team@android.com, maennich@google.com,
	Jessica Yu <jeyu@kernel.org>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Martijn Coenen <maco@android.com>,
	Lucas De Marchi <lucas.de.marchi@gmail.com>,
	Shaun Ruffell <sruffell@sruffell.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Will Deacon <will@kernel.org>,
	linux-kbuild@vger.kernel.org, linux-modules@vger.kernel.org
Subject: [PATCH v2 2/4] modpost: make updating the symbol namespace explicit
Date: Fri, 18 Oct 2019 10:31:41 +0100	[thread overview]
Message-ID: <20191018093143.15997-3-maennich@google.com> (raw)
In-Reply-To: <20191018093143.15997-1-maennich@google.com>

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 <will@kernel.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
---
 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


  parent reply	other threads:[~2019-10-18  9:32 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10 15:14 [PATCH 0/4] export/modpost: avoid renaming __ksymtab entries for symbol namespaces Matthias Maennich
2019-10-10 15:14 ` [PATCH 1/4] modpost: delegate updating namespaces to separate function Matthias Maennich
2019-10-11 14:24   ` Will Deacon
2019-10-11 15:32   ` Greg Kroah-Hartman
2019-10-12  3:19     ` Masahiro Yamada
2019-10-10 15:14 ` [PATCH 2/4] modpost: make updating the symbol namespace explict Matthias Maennich
2019-10-11 14:24   ` Will Deacon
2019-10-11 15:33   ` Greg Kroah-Hartman
2019-10-12  3:22   ` Masahiro Yamada
2019-10-10 15:14 ` [PATCH 3/4] symbol namespaces: revert to previous __ksymtab name scheme Matthias Maennich
2019-10-11 14:24   ` Will Deacon
2019-10-11 15:33   ` Greg Kroah-Hartman
2019-10-12  3:35   ` Masahiro Yamada
2019-10-10 15:14 ` [PATCH 4/4] export: avoid code duplication in include/linux/export.h Matthias Maennich
2019-10-11 15:31   ` Greg Kroah-Hartman
2019-10-11 15:43     ` Matthias Maennich
2019-10-12  4:25       ` Masahiro Yamada
2019-10-18  9:31 ` [PATCH v2 0/4] export/modpost: avoid renaming __ksymtab entries for symbol namespaces Matthias Maennich
2019-10-18  9:31   ` [PATCH v2 1/4] modpost: delegate updating namespaces to separate function Matthias Maennich
2019-10-18  9:31   ` Matthias Maennich [this message]
2019-10-18  9:31   ` [PATCH v2 3/4] symbol namespaces: revert to previous __ksymtab name scheme Matthias Maennich
2019-10-18  9:31   ` [PATCH v2 4/4] export: avoid code duplication in include/linux/export.h Matthias Maennich
2019-10-21 13:31   ` [PATCH v2 0/4] export/modpost: avoid renaming __ksymtab entries for symbol namespaces Jessica Yu
2019-10-23 12:22   ` Luis Chamberlain
2019-10-24  9:35     ` Matthias Maennich
2019-10-24 10:24       ` Luis Chamberlain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191018093143.15997-3-maennich@google.com \
    --to=maennich@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jeyu@kernel.org \
    --cc=kernel-team@android.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=lucas.de.marchi@gmail.com \
    --cc=maco@android.com \
    --cc=sruffell@sruffell.net \
    --cc=will@kernel.org \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).