On Fri, Dec 21, 2018 at 2:28 AM Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote: > > On 06/11/18 23:20, Marc Orr wrote: > > + x86_fpu_cache = kmem_cache_create_usercopy( > > + "x86_fpu", > > + fpu_kernel_xstate_size, > > This unfortunately is wrong because there are other members in struct > fpu before the fpregs_state union. It's enough to run a guest and then > rmmod kvm to see slub errors which are actually caused by memory > corruption. > > The right way to size it is shown in fpu__init_task_struct_size but for > now I'll revert it to sizeof(struct fpu). I have plans to move > fsave/fxsave/xsave directly in KVM, without using the kernel FPU > helpers, and actually this guest_fpu thing will come in handy for that. > :) Once it's done, the size of the object in the cache will be > something like kvm_xstate_size. > > Paolo > > > > + __alignof__(struct fpu), > > + SLAB_ACCOUNT, > > + offsetof(struct fpu, state), > > + fpu_kernel_xstate_size, > > + NULL); > Oops. Thanks for debugging, explaining and fixing!