]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ftrace/x86: Get the current mcount addr for add_breakpoint()
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>
Tue, 6 May 2014 20:26:39 +0000 (16:26 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Wed, 14 May 2014 15:37:28 +0000 (11:37 -0400)
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>
arch/x86/kernel/ftrace.c

index 3d837b00502bcc770c20195d09681fc692ee3411..4b3c195d4133bb26d5cc33ec92a3e1c6adc14b2f 100644 (file)
@@ -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:
@@ -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);