Skip to content

Commit

Permalink
x86, fpu: __restore_xstate_sig()->math_state_restore() needs preempt_…
Browse files Browse the repository at this point in the history
…disable()

Add preempt_disable() + preempt_enable() around math_state_restore() in
__restore_xstate_sig(). Otherwise __switch_to() after __thread_fpu_begin()
can overwrite fpu->state we are going to restore.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Link: http://lkml.kernel.org/r/20140902175717.GA21649@redhat.com
Cc: <stable@vger.kernel.org> # v3.7+
Reviewed-by: Suresh Siddha <sbsiddha@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
  • Loading branch information
Oleg Nesterov authored and H. Peter Anvin committed Sep 2, 2014
1 parent 66463db commit df24fb8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion arch/x86/kernel/xsave.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,11 @@ int __restore_xstate_sig(void __user *buf, void __user *buf_fx, int size)
set_used_math();
}

if (use_eager_fpu())
if (use_eager_fpu()) {
preempt_disable();
math_state_restore();
preempt_enable();
}

return err;
} else {
Expand Down

0 comments on commit df24fb8

Please sign in to comment.