]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
x86, 64-bit: Move K8 B step iret fixup to fault entry asm
authorBrian Gerst <brgerst@gmail.com>
Mon, 12 Oct 2009 14:18:23 +0000 (10:18 -0400)
committerWilly Tarreau <w@1wt.eu>
Sat, 13 Dec 2014 14:16:06 +0000 (15:16 +0100)
Move the handling of truncated %rip from an iret fault to the fault
entry path.

This allows x86-64 to use the standard search_extable() function.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jan Beulich <jbeulich@novell.com>
LKML-Reference: <1255357103-5418-1-git-send-email-brgerst@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
(cherry picked from commit ae24ffe5ecec17c956ac25371d7c2e12b4b36e53)
[wt: only merged to fix patch context and ease merging of next patches]
Signed-off-by: Willy Tarreau <w@1wt.eu>
arch/x86/include/asm/uaccess.h
arch/x86/kernel/entry_64.S
arch/x86/mm/extable.c

index 61c587484b345ff7d4b62d994a0c24b52b0428e7..99f0ad753f32c482f9f5b222c84cee881696b628 100644 (file)
@@ -570,7 +570,6 @@ extern struct movsl_mask {
 #ifdef CONFIG_X86_32
 # include "uaccess_32.h"
 #else
-# define ARCH_HAS_SEARCH_EXTABLE
 # include "uaccess_64.h"
 #endif
 
index 34a56a9649c5ed575c774233c5bfb641f8f91392..4f577eb916e00590f0888af7723558daa46462bd 100644 (file)
@@ -1491,12 +1491,17 @@ error_kernelspace:
        leaq irq_return(%rip),%rcx
        cmpq %rcx,RIP+8(%rsp)
        je error_swapgs
-       movl %ecx,%ecx  /* zero extend */
-       cmpq %rcx,RIP+8(%rsp)
-       je error_swapgs
+       movl %ecx,%eax  /* zero extend */
+       cmpq %rax,RIP+8(%rsp)
+       je bstep_iret
        cmpq $gs_change,RIP+8(%rsp)
        je error_swapgs
        jmp error_sti
+
+bstep_iret:
+       /* Fix truncated RIP */
+       movq %rcx,RIP+8(%rsp)
+       je error_swapgs
 END(error_entry)
 
 
index 61b41ca3b5a2ed4bbf1b9100fd870578885182ad..d0474ad2a6e528eb87ef0904edf9311fc035acf3 100644 (file)
@@ -35,34 +35,3 @@ int fixup_exception(struct pt_regs *regs)
 
        return 0;
 }
-
-#ifdef CONFIG_X86_64
-/*
- * Need to defined our own search_extable on X86_64 to work around
- * a B stepping K8 bug.
- */
-const struct exception_table_entry *
-search_extable(const struct exception_table_entry *first,
-              const struct exception_table_entry *last,
-              unsigned long value)
-{
-       /* B stepping K8 bug */
-       if ((value >> 32) == 0)
-               value |= 0xffffffffUL << 32;
-
-       while (first <= last) {
-               const struct exception_table_entry *mid;
-               long diff;
-
-               mid = (last - first) / 2 + first;
-               diff = mid->insn - value;
-               if (diff == 0)
-                       return mid;
-               else if (diff < 0)
-                       first = mid+1;
-               else
-                       last = mid-1;
-       }
-       return NULL;
-}
-#endif