x86/fpu: Replace KVMs home brewed FPU copy from user
authorThomas Gleixner <tglx@linutronix.de>
Fri, 15 Oct 2021 01:16:13 +0000 (03:16 +0200)
committerBorislav Petkov <bp@suse.de>
Wed, 20 Oct 2021 13:27:27 +0000 (15:27 +0200)
commitea4d6938d4c0761672ff6237964a20db3cb95cc1
tree75e04b4e5cc558fa5ca7de6ce69ea31d05c4c0a9
parenta0ff0611c2fbde94f6c9db8351939b08f2cb6797
x86/fpu: Replace KVMs home brewed FPU copy from user

Copying a user space buffer to the memory buffer is already available in
the FPU core. The copy mechanism in KVM lacks sanity checks and needs to
use cpuid() to lookup the offset of each component, while the FPU core has
this information cached.

Make the FPU core variant accessible for KVM and replace the home brewed
mechanism.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: kvm@vger.kernel.org
Link: https://lkml.kernel.org/r/20211015011539.134065207@linutronix.de
arch/x86/include/asm/fpu/api.h
arch/x86/kernel/fpu/core.c
arch/x86/kernel/fpu/xstate.c
arch/x86/kvm/x86.c