x86/fpu: Get rid of copy_supervisor_to_kernel()
authorThomas Gleixner <tglx@linutronix.de>
Wed, 23 Jun 2021 12:01:51 +0000 (14:01 +0200)
committerBorislav Petkov <bp@suse.de>
Wed, 23 Jun 2021 15:53:31 +0000 (17:53 +0200)
commit1f3171252dc586745bb548d48f3bcedfea34b58d
treeecd2505dd43d3255d2a49498e1312fbd3d0162c4
parent9fe8a6f5eed8fff6b2d7dbc99b911334e311732d
x86/fpu: Get rid of copy_supervisor_to_kernel()

If the fast path of restoring the FPU state on sigreturn fails or is not
taken and the current task's FPU is active then the FPU has to be
deactivated for the slow path to allow a safe update of the tasks FPU
memory state.

With supervisor states enabled, this requires to save the supervisor state
in the memory state first. Supervisor states require XSAVES so saving only
the supervisor state requires to reshuffle the memory buffer because XSAVES
uses the compacted format and therefore stores the supervisor states at the
beginning of the memory state. That's just an overengineered optimization.

Get rid of it and save the full state for this case.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Andy Lutomirski <luto@kernel.org>
Reviewed-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20210623121453.734561971@linutronix.de
arch/x86/include/asm/fpu/xstate.h
arch/x86/kernel/fpu/signal.c
arch/x86/kernel/fpu/xstate.c