Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [High] User queries and boot parameters for built-in modules with hyphens in 
their names will silently fail because KBUILD_MODFILE retains hyphens, unlike 
KBUILD_MODNAME.
--

commit 5657a3b8ff6d75b1ecf79e0009e73fb62384f27d
Author: Jim Cromie <[email protected]>

dynamic_debug: use KBUILD_MODFILE for unique builtin module names

This commit changes the module name used by dynamic debug for built-in
modules from KBUILD_MODNAME to KBUILD_MODFILE. This provides unique names
for built-in modules that might otherwise just be called "main".

> diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
> index 2d6983186f37d..aee6f3d0916f4 100644
> --- a/include/linux/dynamic_debug.h
> +++ b/include/linux/dynamic_debug.h
> @@ -8,6 +8,17 @@
>  
>  #include <linux/build_bug.h>
>  
> +/*
> + * Pick the best name for the module:
> + * KBUILD_MODFILE includes the path (e.g., drivers/usb/core/usbcore) for 
> built-ins.
> + * Fall back to KBUILD_MODNAME for modules (loader requires unique names).
> + */
> +#ifdef KBUILD_MODFILE
> +# define DDEBUG_MODNAME KBUILD_MODFILE
> +#else
> +# define DDEBUG_MODNAME KBUILD_MODNAME
> +#endif

[ ... ]

> diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
> index fdb730db385e8..7f78c6b3eeaf7 100644
> --- a/lib/dynamic_debug.c
> +++ b/lib/dynamic_debug.c
> @@ -248,7 +248,8 @@ static int ddebug_change(const struct ddebug_query *query,
>  
>               /* match against the module name */
>               if (query->module &&
> -                 !match_wildcard(query->module, di->mod_name))
> +                 !match_wildcard(query->module, di->mod_name) &&
> +                 !match_wildcard(query->module, kbasename(di->mod_name)))
>                       continue;

[Severity: High]
Since KBUILD_MODFILE retains hyphens (unlike KBUILD_MODNAME, which is
sanitized by the build system to convert hyphens to underscores), will user
queries and boot parameters using underscores fail to match?

For example, if a user passes a boot parameter like snd_hda_intel.dyndbg=+p,
query->module will use underscores.

Because match_wildcard() performs exact character matching without translating
hyphens, will this silently break dynamic debug configuration for built-in
modules with hyphens in their file names?

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=24

Reply via email to