summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-07-30 19:32:39 +0200
committerIngo Molnar <mingo@elte.hu>2008-07-30 19:32:39 +0200
commitb2d9d33412b9d13a40cd314d93ab517950fc5950 (patch)
tree78dd37783657520d46a57e462b799826c4a9d54a /arch/x86/kernel
parentd25ae38b7e005af03843833bbd811ffe8c5f8cb4 (diff)
parent6ffac1e90a17ea0aded5c581204397421eec91b6 (diff)
downloadop-kernel-dev-b2d9d33412b9d13a40cd314d93ab517950fc5950.zip
op-kernel-dev-b2d9d33412b9d13a40cd314d93ab517950fc5950.tar.gz
Merge branch 'x86/fpu' into x86/core
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/signal_64.c11
-rw-r--r--arch/x86/kernel/traps_64.c9
2 files changed, 18 insertions, 2 deletions
diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c
index b45ef8d..ca316b5 100644
--- a/arch/x86/kernel/signal_64.c
+++ b/arch/x86/kernel/signal_64.c
@@ -104,7 +104,16 @@ static inline int restore_i387(struct _fpstate __user *buf)
clts();
task_thread_info(current)->status |= TS_USEDFPU;
}
- return restore_fpu_checking((__force struct i387_fxsave_struct *)buf);
+ err = restore_fpu_checking((__force struct i387_fxsave_struct *)buf);
+ if (unlikely(err)) {
+ /*
+ * Encountered an error while doing the restore from the
+ * user buffer, clear the fpu state.
+ */
+ clear_fpu(tsk);
+ clear_used_math();
+ }
+ return err;
}
/*
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c
index 3f18d73..513caac 100644
--- a/arch/x86/kernel/traps_64.c
+++ b/arch/x86/kernel/traps_64.c
@@ -1131,7 +1131,14 @@ asmlinkage void math_state_restore(void)
}
clts(); /* Allow maths ops (or we recurse) */
- restore_fpu_checking(&me->thread.xstate->fxsave);
+ /*
+ * Paranoid restore. send a SIGSEGV if we fail to restore the state.
+ */
+ if (unlikely(restore_fpu_checking(&me->thread.xstate->fxsave))) {
+ stts();
+ force_sig(SIGSEGV, me);
+ return;
+ }
task_thread_info(me)->status |= TS_USEDFPU;
me->fpu_counter++;
}
OpenPOWER on IntegriCloud