Skip to content

Commit

Permalink
ftrace: prevent ftrace modifications while being kprobe'd, v2
Browse files Browse the repository at this point in the history
add two missing chunks for ftrace+kprobe.

Signed-off-by: Abhishek Sagar <sagar.abhishek@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Abhishek Sagar authored and Ingo Molnar committed Jul 3, 2008
1 parent 760378e commit 98a05ed
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,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);
}

failed = __ftrace_replace_code(rec, old, new, enable);
if (failed && (rec->flags & FTRACE_FL_CONVERTED)) {
Expand Down Expand Up @@ -740,7 +744,10 @@ static int __ftrace_update_code(void *ignore)
ftrace_del_hash(p);
INIT_HLIST_NODE(&p->node);
hlist_add_head(&p->node, &temp_list);
freeze_record(p);
continue;
} else {
unfreeze_record(p);
}

/* convert record (i.e, patch mcount-call with NOP) */
Expand Down

0 comments on commit 98a05ed

Please sign in to comment.