From d154c8f0f41f321433ff4142c5f432f09e444ea0 Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Mon, 6 Oct 2003 17:55:59 -0700 Subject: [PATCH] [PATCH] Fix x86-64 signal FPU saving bug Don't overwrite FPU state unconditionally in init_fpu. The child == current check is probably not needed, it's just paranoia. --- arch/x86_64/kernel/i387.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86_64/kernel/i387.c b/arch/x86_64/kernel/i387.c index dbe02ec1e3d3b..0d7be118ab407 100644 --- a/arch/x86_64/kernel/i387.c +++ b/arch/x86_64/kernel/i387.c @@ -53,6 +53,11 @@ void __init fpu_init(void) */ void init_fpu(struct task_struct *child) { + if (child->used_math) { + if (child == current) + unlazy_fpu(child); + return; + } memset(&child->thread.i387.fxsave, 0, sizeof(struct i387_fxsave_struct)); child->thread.i387.fxsave.cwd = 0x37f; child->thread.i387.fxsave.mxcsr = 0x1f80; -- 2.53.0