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/[email protected]/

Reported-by: Stefan Wahren <[email protected]>
Fixes: 8651ec01daed ("module: add support for symbol namespaces.")
Cc: Masahiro Yamada <[email protected]>
Cc: Lucas De Marchi <[email protected]>
Cc: Jessica Yu <[email protected]>
Cc: Martijn Coenen <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: [email protected]
Signed-off-by: Matthias Maennich <[email protected]>
---

Please note this depends on the new ksymtab entry format proposed in
https://lore.kernel.org/lkml/[email protected]/

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 via email to