All of lore.kernel.org
 help / color / mirror / Atom feed
* ptrace && fpu_lazy_restore
@ 2012-04-14 23:52 Oleg Nesterov
  2012-04-14 23:59 ` Oleg Nesterov
  2012-04-15  2:03 ` Linus Torvalds
  0 siblings, 2 replies; 10+ messages in thread
From: Oleg Nesterov @ 2012-04-14 23:52 UTC (permalink / raw)
  To: H. Peter Anvin, Linus Torvalds; +Cc: Chuck Ebbert, Jan Kratochvil, linux-kernel

Credits to Jan and Chuck, see

	https://bugzilla.redhat.com/show_bug.cgi?id=810668

with reproducer:

	https://bugzilla.redhat.com/attachment.cgi?id=577270

But afaics the root of the problem is clear. Once PTRACE_SETFPREGS
changes fpu.state->fxsave the task obviously needs restore_fpu_checking()
on context switch.

But I am not sure about the fix, and in any case I need more time
to read this new code.

Oleg.

--- x/arch/x86/kernel/i387.c~	2012-04-09 20:12:12.000000000 +0200
+++ x/arch/x86/kernel/i387.c	2012-04-15 01:34:09.000000000 +0200
@@ -301,6 +301,8 @@ int xfpregs_set(struct task_struct *targ
 
 	sanitize_i387_state(target);
 
+	target->thread.fpu.last_cpu = ~0;
+
 	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
 				 &target->thread.fpu.state->fxsave, 0, -1);
 
@@ -563,6 +565,8 @@ int fpregs_set(struct task_struct *targe
 
 	sanitize_i387_state(target);
 
+	target->thread.fpu.last_cpu = ~0;
+
 	if (!HAVE_HWFP)
 		return fpregs_soft_set(target, regset, pos, count, kbuf, ubuf);
 


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

end of thread, other threads:[~2012-04-17  0:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-14 23:52 ptrace && fpu_lazy_restore Oleg Nesterov
2012-04-14 23:59 ` Oleg Nesterov
2012-04-15  2:03 ` Linus Torvalds
2012-04-15 22:38   ` Oleg Nesterov
2012-04-15 23:42     ` Linus Torvalds
2012-04-15 23:46       ` Linus Torvalds
2012-04-16 20:47         ` [PATCH 0/1] i387: ptrace breaks the lazy-fpu-restore logic Oleg Nesterov
2012-04-16 20:48           ` [PATCH 1/1] " Oleg Nesterov
2012-04-16 22:09             ` Oleg Nesterov
2012-04-17  0:05             ` [tip:x86/urgent] " tip-bot for Oleg Nesterov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.