aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/entry_64.S
diff options
context:
space:
mode:
authorVegard Nossum <vegard.nossum@gmail.com>2008-06-27 11:22:17 -0400
committerIngo Molnar <mingo@elte.hu>2008-06-27 11:45:59 -0400
commit9d8ad5d6c7fce31fd2c0fd4fe9977bda3e92e340 (patch)
tree1760e6576072b880a9b1f9c07879a33cce5306f7 /arch/x86/kernel/entry_64.S
parent543cf4cb3fe6f6cae3651ba918b9c56200b257d0 (diff)
x86: don't destroy %rbp on kernel-mode faults
From the code: "B stepping K8s sometimes report an truncated RIP for IRET exceptions returning to compat mode. Check for these here too." The code then proceeds to truncate the upper 32 bits of %rbp. This means that when do_page_fault() is finally called, its prologue, do_page_fault: push %rbp movl %rsp, %rbp will put the truncated base pointer on the stack. This means that the stack tracer will not be able to follow the base-pointer changes and will see all subsequent stack frames as unreliable. This patch changes the code to use a different register (%rcx) for the checking and leaves %rbp untouched. Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> Acked-by: Arjan van de Ven <arjan@linux.intel.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/entry_64.S')
-rw-r--r--arch/x86/kernel/entry_64.S8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 556a8df522a7..fa1c9eb7f604 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -926,11 +926,11 @@ error_kernelspace:
926 iret run with kernel gs again, so don't set the user space flag. 926 iret run with kernel gs again, so don't set the user space flag.
927 B stepping K8s sometimes report an truncated RIP for IRET 927 B stepping K8s sometimes report an truncated RIP for IRET
928 exceptions returning to compat mode. Check for these here too. */ 928 exceptions returning to compat mode. Check for these here too. */
929 leaq irq_return(%rip),%rbp 929 leaq irq_return(%rip),%rcx
930 cmpq %rbp,RIP(%rsp) 930 cmpq %rcx,RIP(%rsp)
931 je error_swapgs 931 je error_swapgs
932 movl %ebp,%ebp /* zero extend */ 932 movl %ecx,%ecx /* zero extend */
933 cmpq %rbp,RIP(%rsp) 933 cmpq %rcx,RIP(%rsp)
934 je error_swapgs 934 je error_swapgs
935 cmpq $gs_change,RIP(%rsp) 935 cmpq $gs_change,RIP(%rsp)
936 je error_swapgs 936 je error_swapgs