Thread (30 messages) read the whole thread 30 messages, 2 authors, 2026-06-01

Re: [PATCH v3 24/24] dynamic_debug: use KBUILD_MODFILE for unique builtin module names

From: sashiko-bot@kernel.org
Date: 2026-06-01 12:28:13

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 [off-list ref]

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".
quoted hunk ↗ jump to hunk
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
[ ... ]
quoted hunk ↗ jump to hunk
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/20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com?part=24
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help