Skip to content

Commit 1739f09

Browse files
rostedtH. Peter Anvin
authored andcommitted
ftrace/x86: Load ftrace_ops in parameter not the variable holding it
Function tracing callbacks expect to have the ftrace_ops that registered it passed to them, not the address of the variable that holds the ftrace_ops that registered it. Use a mov instead of a lea to store the ftrace_ops into the parameter of the function tracing callback. Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Link: http://lkml.kernel.org/r/20131113152004.459787f9@gandalf.local.home Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Cc: <stable@vger.kernel.org> # v3.8+
1 parent d6e0a2d commit 1739f09

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎arch/x86/kernel/entry_32.S‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ ENTRY(ftrace_caller)
10821082
pushl $0 /* Pass NULL as regs pointer */
10831083
movl 4*4(%esp), %eax
10841084
movl 0x4(%ebp), %edx
1085-
leal function_trace_op, %ecx
1085+
movl function_trace_op, %ecx
10861086
subl $MCOUNT_INSN_SIZE, %eax
10871087

10881088
.globl ftrace_call
@@ -1140,7 +1140,7 @@ ENTRY(ftrace_regs_caller)
11401140
movl 12*4(%esp), %eax /* Load ip (1st parameter) */
11411141
subl $MCOUNT_INSN_SIZE, %eax /* Adjust ip */
11421142
movl 0x4(%ebp), %edx /* Load parent ip (2nd parameter) */
1143-
leal function_trace_op, %ecx /* Save ftrace_pos in 3rd parameter */
1143+
movl function_trace_op, %ecx /* Save ftrace_pos in 3rd parameter */
11441144
pushl %esp /* Save pt_regs as 4th parameter */
11451145

11461146
GLOBAL(ftrace_regs_call)

‎arch/x86/kernel/entry_64.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ END(function_hook)
8888
MCOUNT_SAVE_FRAME \skip
8989

9090
/* Load the ftrace_ops into the 3rd parameter */
91-
leaq function_trace_op, %rdx
91+
movq function_trace_op(%rip), %rdx
9292

9393
/* Load ip into the first parameter */
9494
movq RIP(%rsp), %rdi

0 commit comments

Comments
 (0)