Re: [patch V2 21/52] x86/fpu: Get rid of copy_supervisor_to_kernel()

From: Borislav Petkov
Date: Thu Jun 17 2021 - 08:42:06 EST


On Mon, Jun 14, 2021 at 05:44:29PM +0200, Thomas Gleixner wrote:
> 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@xxxxxxxxxxxxx>
> Reviewed-by: Andy Lutomirski <luto@xxxxxxxxxx>
> ---
> arch/x86/include/asm/fpu/xstate.h | 1
> arch/x86/kernel/fpu/signal.c | 13 +++++---
> arch/x86/kernel/fpu/xstate.c | 55 --------------------------------------
> 3 files changed, 8 insertions(+), 61 deletions(-)

Simplification? To the FPU stinking pile of turds?

Hell yeah!

Reviewed-by: Borislav Petkov <bp@xxxxxxx>

--
Regards/Gruss,
Boris.

SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg