Linux-Modules Archive on lore.kernel.org
 help / color / Atom feed
From: Matthias Maennich <maennich@google.com>
To: linux-kernel@vger.kernel.org
Cc: kernel-team@android.com, maennich@google.com,
	Stefan Wahren <stefan.wahren@i2se.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Lucas De Marchi <lucas.de.marchi@gmail.com>,
	Jessica Yu <jeyu@kernel.org>, Martijn Coenen <maco@android.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-modules@vger.kernel.org
Subject: [PATCH] depmod: create and use System.map.no_namespaces
Date: Fri,  4 Oct 2019 10:57:48 +0100
Message-ID: <20191004095748.223119-1-maennich@google.com> (raw)
In-Reply-To: <20190917231031.81341-1-maennich@google.com>

depmod in its current version is not aware of symbol namespace in
ksymtab entries introduced with 8651ec01daed ("module: add support for
symbol namespaces."). They have the form

  __ksymtab_NAMESPACE.symbol_name

A fix for kmod's depmod has been proposed [1]. In order to support older
versions of depmod as well, create a System.map.no_namespaces during
scripts/depmod.sh that has the pre-namespaces format. That way users do
not immediately upgrade the userspace tool.

[1] https://lore.kernel.org/linux-modules/20191004094136.166621-1-maennich@google.com/

Reported-by: Stefan Wahren <stefan.wahren@i2se.com>
Fixes: 8651ec01daed ("module: add support for symbol namespaces.")
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Lucas De Marchi <lucas.de.marchi@gmail.com>
Cc: Jessica Yu <jeyu@kernel.org>
Cc: Martijn Coenen <maco@android.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-modules@vger.kernel.org
Signed-off-by: Matthias Maennich <maennich@google.com>
---

Please note this depends on the new ksymtab entry format proposed in
https://lore.kernel.org/lkml/20191003075826.7478-2-yamada.masahiro@socionext.com/

That is likely to be merged soon as well as it fixes problems in 5.4-rc*, hence
this patch depends on it.

Cheers,
Matthias

 .gitignore        | 1 +
 scripts/depmod.sh | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 70580bdd352c..5ed58a7cb433 100644
--- a/.gitignore
+++ b/.gitignore
@@ -59,6 +59,7 @@ modules.order
 /vmlinux-gdb.py
 /vmlinuz
 /System.map
+/System.map.no_namespaces
 /Module.markers
 /modules.builtin.modinfo
 
diff --git a/scripts/depmod.sh b/scripts/depmod.sh
index e083bcae343f..602e1af072c7 100755
--- a/scripts/depmod.sh
+++ b/scripts/depmod.sh
@@ -39,7 +39,13 @@ if $depmod_hack_needed; then
 	KERNELRELEASE=99.98.$KERNELRELEASE
 fi
 
-set -- -ae -F System.map
+# Older versions of depmod do not support symbol namespaces in ksymtab entries,
+# hence create an alternative System.map with namespace patched out to use for
+# depmod. I.e. transform entries as follows:
+#    __ksymtab_NAMESPACE.symbol_name -> __ksymtab_symbol_name
+sed 's/__ksymtab_.*\./__ksymtab_/' System.map > System.map.no_namespaces
+
+set -- -ae -F System.map.no_namespaces
 if test -n "$INSTALL_MOD_PATH"; then
 	set -- "$@" -b "$INSTALL_MOD_PATH"
 fi
-- 
2.23.0.581.g78d2f28ef7-goog


       reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190917231031.81341-1-maennich@google.com>
2019-10-04  9:57 ` Matthias Maennich [this message]
2019-10-04 18:25   ` Lucas De Marchi
2019-10-05  7:53     ` Masahiro Yamada
2019-10-07  6:46       ` Matthias Maennich
2019-10-07 11:25         ` Jessica Yu

Reply instructions:

You may reply publically 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=20191004095748.223119-1-maennich@google.com \
    --to=maennich@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jeyu@kernel.org \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=lucas.de.marchi@gmail.com \
    --cc=maco@android.com \
    --cc=stefan.wahren@i2se.com \
    --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

Linux-Modules Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-modules/0 linux-modules/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-modules linux-modules/ https://lore.kernel.org/linux-modules \
		linux-modules@vger.kernel.org
	public-inbox-index linux-modules

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-modules


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git