[PATCH 3.10 44/55] x86/fpu: Drop_fpu() should not assume that tsk equals current
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: 2015-03-24 15:48:37
Also in:
lkml
3.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Oleg Nesterov <oleg@redhat.com> commit f4c3686386393c120710dd34df2a74183ab805fd upstream. drop_fpu() does clear_used_math() and usually this is correct because tsk == current. However switch_fpu_finish()->restore_fpu_checking() is called before __switch_to() updates the "current_task" variable. If it fails, we will wrongly clear the PF_USED_MATH flag of the previous task. So use clear_stopped_child_used_math() instead. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Borislav Petkov <redacted> Reviewed-by: Rik van Riel <redacted> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Borislav Petkov <bp@alien8.de> Cc: Dave Hansen <redacted> Cc: Fenghua Yu <redacted> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Pekka Riikonen <redacted> Cc: Quentin Casasnovas <redacted> Cc: Suresh Siddha <redacted> Cc: Thomas Gleixner <redacted> Link: http://lkml.kernel.org/r/20150309171041.GB11388@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- arch/x86/include/asm/fpu-internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
--- a/arch/x86/include/asm/fpu-internal.h
+++ b/arch/x86/include/asm/fpu-internal.h@@ -370,7 +370,7 @@ static inline void drop_fpu(struct task_ preempt_disable(); tsk->fpu_counter = 0; __drop_fpu(tsk); - clear_used_math(); + clear_stopped_child_used_math(tsk); preempt_enable(); }