Skip to content

Commit

Permalink
x86/stackframe, x86/ftrace: Add pt_regs frame annotations
Browse files Browse the repository at this point in the history
When CONFIG_FRAME_POINTER, we should mark pt_regs frames.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Jun 25, 2019
1 parent 4201311 commit ea1ed38
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arch/x86/kernel/ftrace_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <asm/export.h>
#include <asm/ftrace.h>
#include <asm/nospec-branch.h>
#include <asm/frame.h>

# define function_hook __fentry__
EXPORT_SYMBOL(__fentry__)
Expand Down Expand Up @@ -116,6 +117,8 @@ ENTRY(ftrace_regs_caller)
pushl %ecx
pushl %ebx

ENCODE_FRAME_POINTER

movl 12*4(%esp), %eax /* Load ip (1st parameter) */
subl $MCOUNT_INSN_SIZE, %eax /* Adjust ip */
movl 15*4(%esp), %edx /* Load parent ip (2nd parameter) */
Expand Down
3 changes: 3 additions & 0 deletions arch/x86/kernel/ftrace_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <asm/export.h>
#include <asm/nospec-branch.h>
#include <asm/unwind_hints.h>
#include <asm/frame.h>

.code64
.section .entry.text, "ax"
Expand Down Expand Up @@ -203,6 +204,8 @@ GLOBAL(ftrace_regs_caller_op_ptr)
leaq MCOUNT_REG_SIZE+8*2(%rsp), %rcx
movq %rcx, RSP(%rsp)

ENCODE_FRAME_POINTER

/* regs go into 4th parameter */
leaq (%rsp), %rcx

Expand Down

0 comments on commit ea1ed38

Please sign in to comment.