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

From
Masahiro Yamada <masahiroy@kernel.org>
Date
2025-05-22 05:31:55
Also in
linux-kbuild, lkml
Reply to
Masahiro Yamada, 2025-05-17
On Sat, May 17, 2025 at 4:19 PM Masahiro Yamada [off-list ref] wrote:
On Fri, May 2, 2025 at 11:26 PM Peter Zijlstra [off-list ref] wrote:
quoted
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>
---
quoted
 static void check_exports(struct module *mod)
 {
        struct symbol *s, *exp;
@@ -1709,7 +1717,8 @@ static void check_exports(struct module

                basename = get_basename(mod->name);

-               if (!contains_namespace(&mod->imported_namespaces, exp->namespace)) {
+               if (!verify_module_namespace(exp->namespace, basename) &&
+                   !contains_namespace(&mod->imported_namespaces, exp->namespace)) {
                        modpost_log(!allow_missing_ns_imports,
                                    "module %s uses symbol %s from namespace %s, but does not import it.\n",
                                    basename, exp->name, exp->namespace);

I believe this code is wrong because "make nsdeps" would
incorrectly add MOULDE_IMPORT_NS().


When MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS=y,
EXPORT_SYMBOL_NS(foo, "module:bar") can be used by
any module or not.
That is not what we have decided yet.

At least, MODULE_IMPORT_NS("module:bar");
does not solve the issue at all.

Peter is not responding to my feedback.

I will apply this and fix the code by myself on top of that.



-- 
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