Re: [PATCH -v2 5/7] module: Extend the MODULE_ namespace parsing

Peter Zijlstra
2025-05-02T13:12:32Z

On Sat, Feb 08, 2025 at 12:45:21AM +0900, Masahiro Yamada wrote:
> On Tue, Dec 3, 2024 at 12:11 AM Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > Instead of only accepting "MODULE_${name}", extend it with a comma
> > separated list of module names and add tail glob support.
> >
> > That is, something like: "MODULE_foo-*,bar" is now possible.
> >
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> > ---
> > kernel/module/main.c | 39 ++++++++++++++++++++++++++++++++++-----
> > scripts/mod/modpost.c | 40 ++++++++++++++++++++++++++++++++++------
> > 2 files changed, 68 insertions(+), 11 deletions(-)
> >
>
> > static void check_exports(struct module *mod)
> > {
> > struct symbol *s, *exp;
> > @@ -1714,7 +1741,8 @@ static void check_exports(struct module
> >
> > basename = mod_basename(mod->name);
> >
> > - if (!contains_namespace(&mod->imported_namespaces, exp->namespace)) {
> > + if (!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);
> >
>
> When module_namespace() fails, the following error message is shown:
>
> ERROR: modpost: module bar uses symbol foo from namespace
> MODULE_kvm, but does not import it.
>
>
> We get a hint from this error message, but the solution
> is not MODULE_IMPORT_NS();
>
> 'make nsdeps' will try to solve this by adding
>
> MODULE_IMPORT_NS("MODULE_kvm");
>
> Apparently, this does not work.
>
> Not sure if you want to solve the issue.

Seems unsolvable by construction; so no.