]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - arch/x86/kernel/traps.c
x86/traps: Fix up general protection faults caused by UMIP
[linux.git] / arch / x86 / kernel / traps.c
index 67db4f43309ecadc86f4d7e95c6a0db0650a0d18..ab54bf398803f1b4a59c3b7190ed7a22ceba8390 100644 (file)
@@ -60,6 +60,7 @@
 #include <asm/trace/mpx.h>
 #include <asm/mpx.h>
 #include <asm/vm86.h>
+#include <asm/umip.h>
 
 #ifdef CONFIG_X86_64
 #include <asm/x86_init.h>
@@ -141,8 +142,7 @@ void ist_begin_non_atomic(struct pt_regs *regs)
         * will catch asm bugs and any attempt to use ist_preempt_enable
         * from double_fault.
         */
-       BUG_ON((unsigned long)(current_top_of_stack() -
-                              current_stack_pointer) >= THREAD_SIZE);
+       BUG_ON(!on_thread_stack());
 
        preempt_enable_no_resched();
 }
@@ -514,6 +514,11 @@ do_general_protection(struct pt_regs *regs, long error_code)
        RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU");
        cond_local_irq_enable(regs);
 
+       if (static_cpu_has(X86_FEATURE_UMIP)) {
+               if (user_mode(regs) && fixup_umip_exception(regs))
+                       return;
+       }
+
        if (v8086_mode(regs)) {
                local_irq_enable();
                handle_vm86_fault((struct kernel_vm86_regs *) regs, error_code);