diff options
author | Andy Lutomirski <luto@kernel.org> | 2019-05-14 16:24:39 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2019-05-16 03:05:11 -0400 |
commit | 88640e1dcd089879530a49a8d212d1814678dfe7 (patch) | |
tree | b3bfb6be2d0f41cef5c8d3b7797f55e70e510c61 | |
parent | 00f5764dbb040188e5dce2cd9e648360886b045c (diff) |
x86/speculation/mds: Revert CPU buffer clear on double fault exit
The double fault ESPFIX path doesn't return to user mode at all --
it returns back to the kernel by simulating a #GP fault.
prepare_exit_to_usermode() will run on the way out of
general_protection before running user code.
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@suse.de>
Cc: Frederic Weisbecker <frederic@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jon Masters <jcm@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Fixes: 04dcbdb80578 ("x86/speculation/mds: Clear CPU buffers on exit to user")
Link: http://lkml.kernel.org/r/ac97612445c0a44ee10374f6ea79c222fe22a5c4.1557865329.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | Documentation/x86/mds.rst | 7 | ||||
-rw-r--r-- | arch/x86/kernel/traps.c | 8 |
2 files changed, 0 insertions, 15 deletions
diff --git a/Documentation/x86/mds.rst b/Documentation/x86/mds.rst index 534e9baa4e1d..0dc812bb9249 100644 --- a/Documentation/x86/mds.rst +++ b/Documentation/x86/mds.rst | |||
@@ -158,13 +158,6 @@ Mitigation points | |||
158 | mitigated on the return from do_nmi() to provide almost complete | 158 | mitigated on the return from do_nmi() to provide almost complete |
159 | coverage. | 159 | coverage. |
160 | 160 | ||
161 | - Double fault (#DF): | ||
162 | |||
163 | A double fault is usually fatal, but the ESPFIX workaround, which can | ||
164 | be triggered from user space through modify_ldt(2) is a recoverable | ||
165 | double fault. #DF uses the paranoid exit path, so explicit mitigation | ||
166 | in the double fault handler is required. | ||
167 | |||
168 | - Machine Check Exception (#MC): | 161 | - Machine Check Exception (#MC): |
169 | 162 | ||
170 | Another corner case is a #MC which hits between the CPU buffer clear | 163 | Another corner case is a #MC which hits between the CPU buffer clear |
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index 7de466eb960b..8b6d03e55d2f 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c | |||
@@ -58,7 +58,6 @@ | |||
58 | #include <asm/alternative.h> | 58 | #include <asm/alternative.h> |
59 | #include <asm/fpu/xstate.h> | 59 | #include <asm/fpu/xstate.h> |
60 | #include <asm/trace/mpx.h> | 60 | #include <asm/trace/mpx.h> |
61 | #include <asm/nospec-branch.h> | ||
62 | #include <asm/mpx.h> | 61 | #include <asm/mpx.h> |
63 | #include <asm/vm86.h> | 62 | #include <asm/vm86.h> |
64 | #include <asm/umip.h> | 63 | #include <asm/umip.h> |
@@ -368,13 +367,6 @@ dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code) | |||
368 | regs->ip = (unsigned long)general_protection; | 367 | regs->ip = (unsigned long)general_protection; |
369 | regs->sp = (unsigned long)&gpregs->orig_ax; | 368 | regs->sp = (unsigned long)&gpregs->orig_ax; |
370 | 369 | ||
371 | /* | ||
372 | * This situation can be triggered by userspace via | ||
373 | * modify_ldt(2) and the return does not take the regular | ||
374 | * user space exit, so a CPU buffer clear is required when | ||
375 | * MDS mitigation is enabled. | ||
376 | */ | ||
377 | mds_user_clear_cpu_buffers(); | ||
378 | return; | 370 | return; |
379 | } | 371 | } |
380 | #endif | 372 | #endif |