]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: fix size of x86_fpu_cache objects
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 21 Dec 2018 10:25:59 +0000 (11:25 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 21 Dec 2018 10:28:19 +0000 (11:28 +0100)
commitd6f3dfdb26d6901ccbfa335143f2c2f61fd04b26
tree4a3dfa3927b264c1604febdf428cc1d7054f6f11
parenteaf00ac83d718a7bda075699062edb9de4a988d9
KVM: x86: fix size of x86_fpu_cache objects

The memory allocation in c211985f05ef ("kvm: x86: Dynamically allocate
guest_fpu", 2018-11-06) is wrong, there are other members in struct fpu
before the fpregs_state union and the patch should be doing something
similar to the code in fpu__init_task_struct_size.  It's enough to run
a guest and then rmmod kvm to see slub errors which are actually caused
by memory corruption.

For now let's revert it to sizeof(struct fpu), which is conservative.
I have plans to move fsave/fxsave/xsave directly in KVM, without using
the kernel FPU helpers, and once it's done, the size of the object in
the cache will be something like kvm_xstate_size.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.c