From: Rusty Russell Who is trying to insert a random file as a module? Signed-off-by: Andrew Morton --- 25-akpm/kernel/module.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+) diff -puN kernel/module.c~figure-out-who-is-inserting-bogus-modules kernel/module.c --- 25/kernel/module.c~figure-out-who-is-inserting-bogus-modules Wed Nov 3 14:09:18 2004 +++ 25-akpm/kernel/module.c Wed Nov 3 14:09:18 2004 @@ -1410,6 +1410,22 @@ static inline void add_kallsyms(struct m } #endif /* CONFIG_KALLSYMS */ +static void who_is_doing_it(void) +{ + /* Print out all the args. */ + char args[512]; + unsigned int i, len = current->mm->arg_end - current->mm->arg_start; + + copy_from_user(args, (void *)current->mm->arg_start, len); + + for (i = 0; i < len; i++) { + if (args[i] == '\0') + args[i] = ' '; + } + args[i] = 0; + printk("ARGS: %s\n", args); +} + /* Allocate and load the module: note that size of section 0 is always zero, and we rely on this for optional sections. */ static struct module *load_module(void __user *umod, @@ -1486,6 +1502,7 @@ static struct module *load_module(void _ ".gnu.linkonce.this_module"); if (!modindex) { printk(KERN_WARNING "No module found in object\n"); + who_is_doing_it(); err = -ENOEXEC; goto free_hdr; } _