summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2012-04-16 22:48:15 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-05-07 08:53:22 -0700
commitb4ecb76e392c7fa81230f07356188102ffa106b9 (patch)
treece4327e76eefee6452a5a119b66c2d2420cce15e /arch
parent9f4660213e58b3b78dc75bf3e3b4126dbe9a0b14 (diff)
downloadlwn-b4ecb76e392c7fa81230f07356188102ffa106b9.tar.gz
lwn-b4ecb76e392c7fa81230f07356188102ffa106b9.zip
i387: ptrace breaks the lazy-fpu-restore logic
commit 089f9fba56faf33cc6dd2a6442b7ac92c58b8209 upstream. Starting from 7e16838d "i387: support lazy restore of FPU state" we assume that fpu_owner_task doesn't need restore_fpu_checking() on the context switch, its FPU state should match what we already have in the FPU on this CPU. However, debugger can change the tracee's FPU state, in this case we should reset fpu.last_cpu to ensure fpu_lazy_restore() can't return true. Change init_fpu() to do this, it is called by user_regset->set() methods. Reported-by: Jan Kratochvil <jan.kratochvil@redhat.com> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Oleg Nesterov <oleg@redhat.com> Link: http://lkml.kernel.org/r/20120416204815.GB24884@redhat.com Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/i387.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index 739d8598f789..f239f301db2e 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -154,6 +154,7 @@ int init_fpu(struct task_struct *tsk)
if (tsk_used_math(tsk)) {
if (HAVE_HWFP && tsk == current)
unlazy_fpu(tsk);
+ tsk->thread.fpu.last_cpu = ~0;
return 0;
}