]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - arch/x86/kernel/traps_64.c
x64, fpu: fix possible FPU leakage in error conditions
[mirror_ubuntu-bionic-kernel.git] / arch / x86 / kernel / traps_64.c
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++;
 }