x86/fpu/signal: Remove the legacy alignment check
authorThomas Gleixner <tglx@linutronix.de>
Wed, 23 Jun 2021 12:02:26 +0000 (14:02 +0200)
committerBorislav Petkov <bp@suse.de>
Wed, 23 Jun 2021 18:01:55 +0000 (20:01 +0200)
Checking for the XSTATE buffer being 64-byte aligned, and if not,
deciding just to restore the FXSR state is daft.

If user space provides an unaligned math frame and has the extended state
magic set in the FX software reserved bytes, then it really can keep the
pieces.

If the frame is unaligned and the FX software magic is not set, then
fx_only is already set and the restore will use fxrstor.

Remove it.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20210623121457.184149902@linutronix.de
arch/x86/kernel/fpu/signal.c

index 42e85c3fe9de04e7e461d99757733b73e212aac2..8a327c05bb865423d0d197ff9059c01e2dc958c7 100644 (file)
@@ -306,9 +306,6 @@ static int __fpu_restore_sig(void __user *buf, void __user *buf_fx,
                }
        }
 
-       if ((unsigned long)buf_fx % 64)
-               fx_only = 1;
-
        if (!ia32_fxstate) {
                /*
                 * Attempt to restore the FPU registers directly from user