public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 2.6.17-rc3] i386: fix broken FP exception handling
@ 2006-04-29 18:07 Chuck Ebbert
  2006-04-30  8:42 ` Andi Kleen
  2006-05-01 20:35 ` [stable] " Greg KH
  0 siblings, 2 replies; 4+ messages in thread
From: Chuck Ebbert @ 2006-04-29 18:07 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andi Kleen, Andrew Morton, Linus Torvalds, linux-stable

The FXSAVE information leak patch introduced a bug in FP exception
handling: it clears FP exceptions only when there are already
none outstanding.  Mikael Pettersson reported that causes problems
with the Erlang runtime and has tested this fix.

Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com>
Acked-by: Mikael Pettersson <mikpe@it.uu.se>

---

The same bug is in 2.6.16.9+ and this patch applies there as well.


--- 2.6.17-rc3-d4.orig/include/asm-i386/i387.h
+++ 2.6.17-rc3-d4/include/asm-i386/i387.h
@@ -58,13 +58,13 @@ static inline void __save_init_fpu( stru
 	alternative_input(
 		"fnsave %[fx] ;fwait;" GENERIC_NOP8 GENERIC_NOP4,
 		"fxsave %[fx]\n"
-		"bt $7,%[fsw] ; jc 1f ; fnclex\n1:",
+		"bt $7,%[fsw] ; jnc 1f ; fnclex\n1:",
 		X86_FEATURE_FXSR,
 		[fx] "m" (tsk->thread.i387.fxsave),
 		[fsw] "m" (tsk->thread.i387.fxsave.swd) : "memory");
 	/* AMD K7/K8 CPUs don't save/restore FDP/FIP/FOP unless an exception
 	   is pending.  Clear the x87 state here by setting it to fixed
-   	   values. __per_cpu_offset[0] is a random variable that should be in L1 */
+   	   values. safe_address is a random variable that should be in L1 */
 	alternative_input(
 		GENERIC_NOP8 GENERIC_NOP2,
 		"emms\n\t"	  	/* clear stack tags */
-- 
Chuck
"Penguins don't come from next door, they come from the Antarctic!"

^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: [patch 2.6.17-rc3] i386: fix broken FP exception handling
@ 2006-04-29 18:39 Mikael Pettersson
  0 siblings, 0 replies; 4+ messages in thread
From: Mikael Pettersson @ 2006-04-29 18:39 UTC (permalink / raw)
  To: 76306.1226, linux-kernel; +Cc: ak, akpm, stable, torvalds

On Sat, 29 Apr 2006 14:07:49 -0400, Chuck Ebbert wrote:
>The FXSAVE information leak patch introduced a bug in FP exception
>handling: it clears FP exceptions only when there are already
>none outstanding.  Mikael Pettersson reported that causes problems
>with the Erlang runtime and has tested this fix.
>
>Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com>
>Acked-by: Mikael Pettersson <mikpe@it.uu.se>

To clarify: the problem the bug caused was not that it broke
Erlang, but that running Erlang (which enables and uses FP
exceptions) caused the kernel to oops badly and hang.

/Mikael

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

end of thread, other threads:[~2006-05-01 20:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-29 18:07 [patch 2.6.17-rc3] i386: fix broken FP exception handling Chuck Ebbert
2006-04-30  8:42 ` Andi Kleen
2006-05-01 20:35 ` [stable] " Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2006-04-29 18:39 Mikael Pettersson

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