Skip to contentSkip to conversation

Lazy FPU handling in ptrace

PATCH New Andi Kleen 1 participant 1 message Mar 14, 2003 ptrace support

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 Lazy FPU handling in ptrace

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

arch/i386/kernel/ptrace.c renamed from arch/i386/kernel/ptrace.c-o +2 -0
@@ -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;