Re: ftrace/kprobes: Warning when insmod two modules

From: Steven Rostedt
Date: Thu Apr 24 2014 - 08:49:55 EST


On Thu, 24 Apr 2014 15:58:53 +0900
Takao Indoh <indou.takao@xxxxxxxxxxxxxx> wrote:

> Ok, I'll do this. Something like this, right?
>
> static void ftrace_init_module(struct module *mod,
> unsigned long *start, unsigned long *end)
> {
> if (ftrace_disabled || start == end)
> return;
>
> /*
> * Need ftrace_lock here to prevent someone from changing the module
> * text to RO by set_all_modules_text_ro(). Currently ftrace is the
> * only user of set_all_modules_text_ro(), so until another user
> * appears, ftrace_lock mutex can work.
> */
> mutex_lock(&ftrace_lock);
>
> set_one_module_text_rw(mod);
> ftrace_process_locs(mod, start, end);
> set_one_module_text_ro(mod);
>
> mutex_unlock(&ftrace_lock);
> }
>

I like Rusty's solution the best. Just hard code the call to ftrace's
module init code where it is still safe to do so
(MODULE_STATE_UNFORMED). This seems to be an ftrace only issue.

Thanks,

-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/