]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Revert "x86, fpu: Avoid possible error in math_state_restore()"
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 16 Sep 2015 18:23:29 +0000 (11:23 -0700)
committerSantosh Shilimkar <santosh.shilimkar@oracle.com>
Wed, 16 Sep 2015 18:23:29 +0000 (11:23 -0700)
This reverts commit 5b5e1763859439f4733aafc7585b15b28ab94209.

The patch does not fix the underlaying problem. The
patch "xen/fpu:  stts() before the local_irq_enable(), and clts()
after the local_irq_disable()" fixes the issue.

Acked-by: Annie Li <annie.li@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
arch/x86/kernel/traps.c

index 7053048412104e87c3d795fd45f312a1a127fb99..324ab524768756b1987efbee11f06ce3ba24562b 100644 (file)
@@ -841,18 +841,20 @@ void math_state_restore(void)
 {
        struct task_struct *tsk = current;
 
-       /*
-        * FIXME:The patch has one known problem when the machine is running baremetal
-        * (or PVHVM) and when there is low amount of memory. The problem is that the
-        * applications won't get SIGKILL when the FPU area can't be allocated and
-        * instead they will continue on running - without any FPU context
-        * allocated for them. The 'init_fpu(tsk)' can return -ENOMEM and that
-        * patch does not check that condition. This update will be tracked
-        * in another bug since the patch alrady fixes two known issues related
-        * to corruption.
-        */
-       if (!tsk_used_math(tsk))
-               init_fpu(tsk);
+       if (!tsk_used_math(tsk)) {
+               local_irq_enable();
+               /*
+                * does a slab alloc which can sleep
+                */
+               if (init_fpu(tsk)) {
+                       /*
+                        * ran out of memory!
+                        */
+                       do_group_exit(SIGKILL);
+                       return;
+               }
+               local_irq_disable();
+       }
 
        /* Avoid __kernel_fpu_begin() right after __thread_fpu_begin() */
        kernel_fpu_disable();