Skip to contentSkip to conversation

dynamic debug: move ddebug_remove_module() down into free_module()

PATCH In review Jason Baron 3 participants 3 messages Jul 14, 2010 – Jul 22, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dynamic debug: move ddebug_remove_module() down into free_module()

move the call to ddebug_remove_module() down into free_module(). In this way it should be called from all error paths. Currently, we are missing the remove if the module init routine fails.

---
 kernel/module.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
kernel/module.c +3 -1
index 5d2d281..6c56282 100644
@@ -787,7 +787,6 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
 
 	/* Store the name of the last unloaded module for diagnostic purposes */
 	strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module));
-	ddebug_remove_module(mod->name);
 
 	free_module(mod);
 	return 0;
@@ -1550,6 +1549,9 @@ static void free_module(struct module *mod)
 	remove_sect_attrs(mod);
 	mod_kobject_remove(mod);
 
+	/* Remove dynamic debug info */
+	ddebug_remove_module(mod->name);
+
 	/* Arch-specific cleanup. */
 	module_arch_cleanup(mod);
 
Signature · 1 line
1.7.1
#1 lore raw
Quoted 4 lines · On Wed, 14 Jul 2010 16:00:57 -0400 Jason Baron <[email protected]> wrote:

move the call to ddebug_remove_module() down into free_module(). In this way it should be called from all error paths. Currently, we are missing the remove if the module init routine fails.

Quoted 9 lines

Crappy changelog doesn't describe the bug we're fixing. It should.

It's

echo "file ec.c +p" >/sys/kernel/debug/dynamic_debug/control

causes an oops, yes?

Quoted 13 lines
kernel/module.c +0 -1
index 5d2d281..6c56282 100644
@@ -787,7 +787,6 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
 
 	/* Store the name of the last unloaded module for diagnostic purposes */
 	strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module));
-	ddebug_remove_module(mod->name);
 
 	free_module(mod);
 	return 0;

kernel/module.c static void free_module(struct module *mod) · line 1556

Quoted 8 lines
kernel/module.c +3 -0
@@ -1550,6 +1549,9 @@ static void free_module(struct module *mod)
 	remove_sect_attrs(mod);
 	mod_kobject_remove(mod);
 
+	/* Remove dynamic debug info */
+	ddebug_remove_module(mod->name);
+
 	/* Arch-specific cleanup. */
 	module_arch_cleanup(mod);

Should we backport this into 2.6.34.x? Earlier?

#2 lore raw
Quoted 17 lines · On Wednesday 21 July 2010 23:34:23 Andrew Morton wrote:
Quoted 4 lines · On Wed, 14 Jul 2010 16:00:57 -0400 Jason Baron <[email protected]> wrote:

move the call to ddebug_remove_module() down into free_module(). In this way it should be called from all error paths. Currently, we are missing the remove if the module init routine fails.

Quoted 9 lines
Quoted 7 lines

Crappy changelog doesn't describe the bug we're fixing. It should.

It's

echo "file ec.c +p" >/sys/kernel/debug/dynamic_debug/control

causes an oops, yes?

AFAIK the query written doesn't matter.
It's about the declaration of specific modules (see below). If you compile out (a) specific module(s), above query might even work.

...

Quoted 1 line

Should we backport this into 2.6.34.x? Earlier?

We saw oopses in 2.6.32 due to a module without an exit function and overwriting the pr_fmt macro (not 100% sure whether both conditions must be met, according to Hannes' test yes). I expect the patch should go at least back to this one. I can give it a try then whether this also fixes this condition.

Thomas