]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branch 'x86/fpu' into x86/urgent
authorIngo Molnar <mingo@elte.hu>
Thu, 14 Aug 2008 09:18:08 +0000 (11:18 +0200)
committerIngo Molnar <mingo@elte.hu>
Thu, 14 Aug 2008 09:18:08 +0000 (11:18 +0200)
arch/x86/kernel/signal_64.c
arch/x86/kernel/traps_64.c
include/asm-x86/i387.h

index b45ef8ddd6510901ab3d089e1ca21f36a90167d7..ca316b5b742ced782dc3ab4b4c8631b5a9d43a6c 100644 (file)
@@ -104,7 +104,16 @@ static inline int restore_i387(struct _fpstate __user *buf)
                clts();
                task_thread_info(current)->status |= TS_USEDFPU;
        }
-       return restore_fpu_checking((__force struct i387_fxsave_struct *)buf);
+       err = restore_fpu_checking((__force struct i387_fxsave_struct *)buf);
+       if (unlikely(err)) {
+               /*
+                * Encountered an error while doing the restore from the
+                * user buffer, clear the fpu state.
+                */
+               clear_fpu(tsk);
+               clear_used_math();
+       }
+       return err;
 }
 
 /*
index 3f18d73f420c414d809a1046dd5676b992e8676e..513caaca7115eecf5d7a58de7cf12fbe9e60e6e4 100644 (file)
@@ -1131,7 +1131,14 @@ asmlinkage void math_state_restore(void)
        }
 
        clts();                         /* Allow maths ops (or we recurse) */
-       restore_fpu_checking(&me->thread.xstate->fxsave);
+       /*
+        * Paranoid restore. send a SIGSEGV if we fail to restore the state.
+        */
+       if (unlikely(restore_fpu_checking(&me->thread.xstate->fxsave))) {
+               stts();
+               force_sig(SIGSEGV, me);
+               return;
+       }
        task_thread_info(me)->status |= TS_USEDFPU;
        me->fpu_counter++;
 }
index 96fa8449ff11de8dcf4926f3ac541286597168d3..0048fb77afc4551a23eae4561684bfca7cef6ade 100644 (file)
@@ -62,8 +62,6 @@ static inline int restore_fpu_checking(struct i387_fxsave_struct *fx)
 #else
                     : [fx] "cdaSDb" (fx), "m" (*fx), "0" (0));
 #endif
-       if (unlikely(err))
-               init_fpu(current);
        return err;
 }