x86/fpu: Move FXSAVE_LEAK quirk info __copy_kernel_to_fpregs()
authorThomas Gleixner <tglx@linutronix.de>
Wed, 23 Jun 2021 12:02:15 +0000 (14:02 +0200)
committerBorislav Petkov <bp@suse.de>
Wed, 23 Jun 2021 17:26:37 +0000 (19:26 +0200)
commit1d9bffab116fadfe1594f5fea2b50ab280d81d30
treedaeba06043cc6513a4472d81786ad606cf65bfc9
parent727d01100e15b18c67f05fb697779ad2a6c99b63
x86/fpu: Move FXSAVE_LEAK quirk info __copy_kernel_to_fpregs()

copy_kernel_to_fpregs() restores all xfeatures but it is also the place
where the AMD FXSAVE_LEAK bug is handled.

That prevents fpregs_restore_userregs() to limit the restored features,
which is required to untangle PKRU and XSTATE handling and also for the
upcoming supervisor state management.

Move the FXSAVE_LEAK quirk into __copy_kernel_to_fpregs() and deinline that
function which has become rather fat.

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