x86/fpu: Dont restore PKRU in fpregs_restore_userspace()
authorThomas Gleixner <tglx@linutronix.de>
Wed, 23 Jun 2021 12:02:17 +0000 (14:02 +0200)
committerBorislav Petkov <bp@suse.de>
Wed, 23 Jun 2021 17:33:32 +0000 (19:33 +0200)
commit2ebe81c6d800576e1213f9d7cf0068017ae610c1
treee2d315cf6dfda3988070df9aa52d739a982bef87
parent65e952102122bf89f0e4f1bebf8664e32587aaed
x86/fpu: Dont restore PKRU in fpregs_restore_userspace()

switch_to() and flush_thread() write the task's PKRU value eagerly so
the PKRU value of current is always valid in the hardware.

That means there is no point in restoring PKRU on exit to user or when
reactivating the task's FPU registers in the signal frame setup path.

This allows to remove all the xstate buffer updates with PKRU values once
the PKRU state is stored in thread struct while a task is scheduled out.

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/20210623121456.303919033@linutronix.de
arch/x86/include/asm/fpu/internal.h
arch/x86/include/asm/fpu/xstate.h
arch/x86/kernel/fpu/core.c