]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.18.3/x86_64-fix-fpu-corruption.patch
5.0-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.18.3 / x86_64-fix-fpu-corruption.patch
1 From ak@suse.de Fri Nov 10 19:20:02 2006
2 From: Andi Kleen <ak@suse.de>
3 To: stable@kernel.org
4 Subject: x86_64: Fix FPU corruption
5 Date: Sat, 11 Nov 2006 04:16:36 +0100
6 Message-Id: <200611110416.36837.ak@suse.de>
7
8 This reverts an earlier patch that was found to cause FPU
9 state corruption. I think the corruption happens because
10 unlazy_fpu() can cause FPU exceptions and when it happens
11 after the current switch some processing would affect
12 the state in the wrong process.
13
14 Thanks to Douglas Crosher and Tom Hughes for testing.
15
16 Cc: jbeulich@novell.com
17 Signed-off-by: Andi Kleen <ak@suse.de>
18 Signed-off-by: Chris Wright <chrisw@sous-sol.org>
19 ---
20 arch/x86_64/kernel/process.c | 7 +++----
21 1 file changed, 3 insertions(+), 4 deletions(-)
22
23 --- linux-2.6.18.2.orig/arch/x86_64/kernel/process.c
24 +++ linux-2.6.18.2/arch/x86_64/kernel/process.c
25 @@ -571,6 +571,9 @@ __switch_to(struct task_struct *prev_p,
26 prev->gsindex = gsindex;
27 }
28
29 + /* Must be after DS reload */
30 + unlazy_fpu(prev_p);
31 +
32 /*
33 * Switch the PDA and FPU contexts.
34 */
35 @@ -578,10 +581,6 @@ __switch_to(struct task_struct *prev_p,
36 write_pda(oldrsp, next->userrsp);
37 write_pda(pcurrent, next_p);
38
39 - /* This must be here to ensure both math_state_restore() and
40 - kernel_fpu_begin() work consistently.
41 - And the AMD workaround requires it to be after DS reload. */
42 - unlazy_fpu(prev_p);
43 write_pda(kernelstack,
44 task_stack_page(next_p) + THREAD_SIZE - PDA_STACKOFFSET);
45