Commit 31677619 authored by Ingo Molnar's avatar Ingo Molnar

Merge branch 'x86/fpu' into x86/urgent

parents c2dcfde8 6ffac1e9
...@@ -104,7 +104,16 @@ static inline int restore_i387(struct _fpstate __user *buf) ...@@ -104,7 +104,16 @@ static inline int restore_i387(struct _fpstate __user *buf)
clts(); clts();
task_thread_info(current)->status |= TS_USEDFPU; 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;
} }
/* /*
......
...@@ -1131,7 +1131,14 @@ asmlinkage void math_state_restore(void) ...@@ -1131,7 +1131,14 @@ asmlinkage void math_state_restore(void)
} }
clts(); /* Allow maths ops (or we recurse) */ 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; task_thread_info(me)->status |= TS_USEDFPU;
me->fpu_counter++; me->fpu_counter++;
} }
......
...@@ -62,8 +62,6 @@ static inline int restore_fpu_checking(struct i387_fxsave_struct *fx) ...@@ -62,8 +62,6 @@ static inline int restore_fpu_checking(struct i387_fxsave_struct *fx)
#else #else
: [fx] "cdaSDb" (fx), "m" (*fx), "0" (0)); : [fx] "cdaSDb" (fx), "m" (*fx), "0" (0));
#endif #endif
if (unlikely(err))
init_fpu(current);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment