i386: fix broken FP exception handling
PATCH 1/1 i386: fix broken FP exception handling
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.
---
The same bug is in 2.6.16.9+ and this patch applies there as well.
include/asm-i386/i387.h +2 -2
@@ -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 */
Signature · 2 lines
Chuck "Penguins don't come from next door, they come from the Antarctic!"
Quoted 4 lines · Chuck Ebbert
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.
Patch looks correct, thanks. All other cases (x86-64, 2.4) should be already ok.
-Andi
Quoted 11 lines · Chuck Ebbert
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 <[email protected]>---
The same bug is in 2.6.16.9+ and this patch applies there as well.
Thanks, this got included in 2.6.16.12
greg k-h