Skip to content

Commit

Permalink
ftrace/x86: Get the current mcount addr for add_breakpoint()
Browse files Browse the repository at this point in the history
The add_breakpoint() code in the ftrace updating gets the address
of what the call will become, but if the mcount address is changing
from regs to non-regs ftrace_caller or vice versa, it will use what
the record currently is.

This is rather silly as the code should always use what is currently
there regardless of if it's changing the regs function or just converting
to a nop.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Steven Rostedt (Red Hat) committed May 14, 2014
1 parent 68f4096 commit 94792ea
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions arch/x86/kernel/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,9 @@ static int add_breakpoints(struct dyn_ftrace *rec, int enable)
unsigned long ftrace_addr;
int ret;

ret = ftrace_test_record(rec, enable);
ftrace_addr = get_ftrace_old_addr(rec);

ftrace_addr = get_ftrace_addr(rec);
ret = ftrace_test_record(rec, enable);

switch (ret) {
case FTRACE_UPDATE_IGNORE:
Expand All @@ -394,8 +394,6 @@ static int add_breakpoints(struct dyn_ftrace *rec, int enable)

case FTRACE_UPDATE_MODIFY_CALL_REGS:
case FTRACE_UPDATE_MODIFY_CALL:
ftrace_addr = get_ftrace_old_addr(rec);
/* fall through */
case FTRACE_UPDATE_MAKE_NOP:
/* converting a call to a nop */
return add_brk_on_call(rec, ftrace_addr);
Expand Down

0 comments on commit 94792ea

Please sign in to comment.