[3.16.y-ckt stable] Patch "x86/fpu: Drop_fpu() should not assume that tsk equals current" has been added to staging queue

Luis Henriques luis.henriques at canonical.com
Mon Mar 30 13:01:09 UTC 2015


This is a note to let you know that I have just added a patch titled

    x86/fpu: Drop_fpu() should not assume that tsk equals current

to the linux-3.16.y-queue branch of the 3.16.y-ckt extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.16.y-queue

This patch is scheduled to be released in version 3.16.7-ckt10.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.16.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Luis

------

>From 02ee79f2b501a7663f1f4436d8bc6bcb3e40002f Mon Sep 17 00:00:00 2001
From: Oleg Nesterov <oleg at redhat.com>
Date: Fri, 13 Mar 2015 09:53:10 +0100
Subject: x86/fpu: Drop_fpu() should not assume that tsk equals current

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 at redhat.com>
Signed-off-by: Borislav Petkov <bp at suse.de>
Reviewed-by: Rik van Riel <riel at redhat.com>
Cc: Andy Lutomirski <luto at amacapital.net>
Cc: Borislav Petkov <bp at alien8.de>
Cc: Dave Hansen <dave.hansen at intel.com>
Cc: Fenghua Yu <fenghua.yu at intel.com>
Cc: H. Peter Anvin <hpa at zytor.com>
Cc: Linus Torvalds <torvalds at linux-foundation.org>
Cc: Pekka Riikonen <priikone at iki.fi>
Cc: Quentin Casasnovas <quentin.casasnovas at oracle.com>
Cc: Suresh Siddha <sbsiddha at gmail.com>
Cc: Thomas Gleixner <tglx at linutronix.de>
Link: http://lkml.kernel.org/r/20150309171041.GB11388@redhat.com
Signed-off-by: Ingo Molnar <mingo at kernel.org>
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
---
 arch/x86/include/asm/fpu-internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/fpu-internal.h b/arch/x86/include/asm/fpu-internal.h
index 115e3689cd53..0eb93c52e8d4 100644
--- a/arch/x86/include/asm/fpu-internal.h
+++ b/arch/x86/include/asm/fpu-internal.h
@@ -368,7 +368,7 @@ static inline void drop_fpu(struct task_struct *tsk)
 	preempt_disable();
 	tsk->thread.fpu_counter = 0;
 	__drop_fpu(tsk);
-	clear_used_math();
+	clear_stopped_child_used_math(tsk);
 	preempt_enable();
 }





More information about the kernel-team mailing list