[PATCH] Lazy FPU handling in ptrace

From: Andi Kleen (ak@muc.de)
Date: Fri Mar 14 2003 - 15:56:33 EST


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;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Mar 15 2003 - 22:00:41 EST