[PATCH 1/1] x86, xsave: clear pre-allocated xsave area

From: Hans Rosenfeld
Date: Wed Jul 06 2011 - 10:31:19 EST


Bogus data in the xsave area can cause xrstor to panic, so make sure
that the pre-allocated xsave area is all nice and clean before being
used.

Signed-off-by: Hans Rosenfeld <hans.rosenfeld@xxxxxxx>
---
arch/x86/kernel/process.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index c5ae256..03c5ded 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -28,8 +28,15 @@ EXPORT_SYMBOL_GPL(task_xstate_cachep);

int arch_prealloc_fpu(struct task_struct *tsk)
{
- if (!fpu_allocated(&tsk->thread.fpu))
- return fpu_alloc(&tsk->thread.fpu);
+ if (!fpu_allocated(&tsk->thread.fpu)) {
+ int err = fpu_alloc(&tsk->thread.fpu);
+
+ if (err)
+ return err;
+
+ fpu_clear(&tsk->thread.fpu);
+ }
+
return 0;
}

--
1.5.6.5


--qDbXVdCdHGoSgWSk--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/