Skip to content

Commit 4201311

Browse files
Peter ZijlstraIngo Molnar
authored andcommitted
x86/stackframe, x86/kprobes: Fix frame pointer annotations
The kprobe trampolines have a FRAME_POINTER annotation that makes no sense. It marks the frame in the middle of pt_regs, at the place of saving BP. Change it to mark the pt_regs frame as per the ENCODE_FRAME_POINTER from the respective entry_*.S. Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Josh Poimboeuf <[email protected]> Acked-by: Masami Hiramatsu <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
1 parent a9b3c69 commit 4201311

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

arch/x86/kernel/kprobes/common.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,10 @@
55
/* Kprobes and Optprobes common header */
66

77
#include <asm/asm.h>
8-
9-
#ifdef CONFIG_FRAME_POINTER
10-
# define SAVE_RBP_STRING " push %" _ASM_BP "\n" \
11-
" mov %" _ASM_SP ", %" _ASM_BP "\n"
12-
#else
13-
# define SAVE_RBP_STRING " push %" _ASM_BP "\n"
14-
#endif
8+
#include <asm/frame.h>
159

1610
#ifdef CONFIG_X86_64
11+
1712
#define SAVE_REGS_STRING \
1813
/* Skip cs, ip, orig_ax. */ \
1914
" subq $24, %rsp\n" \
@@ -27,11 +22,13 @@
2722
" pushq %r10\n" \
2823
" pushq %r11\n" \
2924
" pushq %rbx\n" \
30-
SAVE_RBP_STRING \
25+
" pushq %rbp\n" \
3126
" pushq %r12\n" \
3227
" pushq %r13\n" \
3328
" pushq %r14\n" \
34-
" pushq %r15\n"
29+
" pushq %r15\n" \
30+
ENCODE_FRAME_POINTER
31+
3532
#define RESTORE_REGS_STRING \
3633
" popq %r15\n" \
3734
" popq %r14\n" \
@@ -51,19 +48,22 @@
5148
/* Skip orig_ax, ip, cs */ \
5249
" addq $24, %rsp\n"
5350
#else
51+
5452
#define SAVE_REGS_STRING \
5553
/* Skip cs, ip, orig_ax and gs. */ \
56-
" subl $16, %esp\n" \
54+
" subl $4*4, %esp\n" \
5755
" pushl %fs\n" \
5856
" pushl %es\n" \
5957
" pushl %ds\n" \
6058
" pushl %eax\n" \
61-
SAVE_RBP_STRING \
59+
" pushl %ebp\n" \
6260
" pushl %edi\n" \
6361
" pushl %esi\n" \
6462
" pushl %edx\n" \
6563
" pushl %ecx\n" \
66-
" pushl %ebx\n"
64+
" pushl %ebx\n" \
65+
ENCODE_FRAME_POINTER
66+
6767
#define RESTORE_REGS_STRING \
6868
" popl %ebx\n" \
6969
" popl %ecx\n" \

0 commit comments

Comments
 (0)