public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Lazy FPU handling in ptrace
@ 2003-03-14 20:56 Andi Kleen
  0 siblings, 0 replies; 2+ messages in thread
From: Andi Kleen @ 2003-03-14 20:56 UTC (permalink / raw)
  To: linux-kernel


While working on some x86-64 ptrace problems I noticed that i386 
has bugs in this area too. 

Before doing PTRACE_SETFPREGS or PTRACE_SETFPXREGS you need to do
an unlazy_fpu(), otherwise there is no guarantee that the changed
state will be picked up.

Patch for 2.4, but 2.5 seems to have it too.

(untested, but obviously correct ;-)
-Andi 

--- linux-work/arch/i386/kernel/ptrace.c-o	2002-08-08 10:27:42.000000000 +0200
+++ linux-work/arch/i386/kernel/ptrace.c	2003-03-14 21:51:21.000000000 +0100
@@ -381,6 +381,7 @@
 			ret = -EIO;
 			break;
 		}
+		unlazy_fpu(child);
 		child->used_math = 1;
 		set_fpregs(child, (struct user_i387_struct *)data);
 		ret = 0;
@@ -405,6 +406,7 @@
 			ret = -EIO;
 			break;
 		}
+		unlazy_fpu(child);
 		child->used_math = 1;
 		ret = set_fpxregs(child, (struct user_fxsr_struct *)data);
 		break;


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Lazy FPU handling in ptrace
@ 2003-03-14 21:11 Manfred Spraul
  0 siblings, 0 replies; 2+ messages in thread
From: Manfred Spraul @ 2003-03-14 21:11 UTC (permalink / raw)
  To: Andi Kleen; +Cc: linux-kernel

Andi wrote:

>(untested, but obviously correct ;-)
>-Andi 
>
Famous last words.
The patch is not needed: __switch_to unlazies the fpu state of the 
previous thread. ptrace PTRACE_SETFPREGS and PTRACE_SETFPXREGS only 
operate on stopped threads, thus it's guaranteed that the fpu state is 
stored in the task structure.

--
    Manfred


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-03-14 21:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-14 20:56 [PATCH] Lazy FPU handling in ptrace Andi Kleen
  -- strict thread matches above, loose matches on Subject: below --
2003-03-14 21:11 Manfred Spraul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox