Re: [PATCH 0/4] ftrace: prevent ftrace modifications while beingkprobe'd

From: Ingo Molnar
Date: Mon Jun 23 2008 - 16:15:48 EST



* Abhishek Sagar <sagar.abhishek@xxxxxxxxx> wrote:

> Hi Steven/Ingo,
>
> These patches address the problem of kprobe registration interfering
> with dynamic ftrace. A kprobe registered on an mcount call-site can
> modify that address multiple times during its duration of probing. At
> the same time, ftrace may simultaneously modify these locations. This
> could be fatal especially if ftrace modifies the call-site during a
> kprobe registration on it (between arch_prepare_kprobe and
> arch_arm_kprobe in __register_kprobe to be more precise). So as a
> "fix", I've disabled any updates on the mcount call-site while it's
> being kprobe'd.

applied to tip/tracing/ftrace, thanks Abhishek.

note that i had to do a number of fixups to themerge, and there was one
chunk which did not merge cleanly and i left it out for now:

@@ -435,8 +502,12 @@ static void ftrace_replace_code(int enable)
continue;

/* ignore updates to this record's mcount site */
- if (get_kprobe((void *)rec->ip))
+ if (get_kprobe((void *)rec->ip)) {
+ freeze_record(rec);
continue;
+ } else {
+ unfreeze_record(rec);
+ }

please send a delta patch against tip/tracing/ftrace to get that kprobes
fix. You can pick up -tip via:

http://people.redhat.com/mingo/tip.git/README

Ingo
--
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/