Re: [PATCH v3 2/5] module: Add module specific symbol namespace support

From
Masahiro Yamada <masahiroy@kernel.org>
Date
2025-05-03 12:30:58
Also in
linux-kbuild, lkml
Reply to
Peter Zijlstra, 2025-05-02
On Fri, May 2, 2025 at 11:26 PM Peter Zijlstra [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Designate the "module:${modname}" symbol namespace to mean: 'only
export to the named module'.

Notably, explicit imports of anything in the "module:" space is
forbidden.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 kernel/module/main.c  |   33 +++++++++++++++++++++++++++++++--
 scripts/mod/modpost.c |   11 ++++++++++-
 2 files changed, 41 insertions(+), 3 deletions(-)
--- a/kernel/module/main.c
+++ b/kernel/module/main.c
@@ -1083,6 +1083,14 @@ static char *get_modinfo(const struct lo
        return get_next_modinfo(info, tag, NULL);
 }

+static bool verify_module_namespace(const char *namespace, const char *modname)
+{
+       const char *prefix = "module:";
+
+       return strstarts(namespace, prefix) &&
+              !strsmp(namespace + strlen(prefix), modname);
Apparently, you did not spend time for per-commit compile testing.

I believe it is a typo of "strcmp()".

I got this build error.

../kernel/module/main.c: In function 'verify_module_namespace':
../kernel/module/main.c:1091:17: error: implicit declaration of
function 'strsmp'; did you mean 'strsep'?
[-Wimplicit-function-declaration]
 1091 |                !strsmp(namespace + strlen(prefix), modname);
      |                 ^~~~~~
      |                 strsep









--
Best Regards
Masahiro Yamada
Thread (21 messages) 21 messages, 4 authors, last reply 2025-05-22
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help