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

From: Masahiro Yamada
Date: Sat May 03 2025 - 08:31:03 EST


On Fri, May 2, 2025 at 11:26 PM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> 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@xxxxxxxxxxxxx>
> ---
> 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