KVM: Assert that struct kvm_vcpu is always as offset zero
authorSean Christopherson <sean.j.christopherson@intel.com>
Thu, 15 Aug 2019 17:22:37 +0000 (10:22 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 22 Aug 2019 08:09:27 +0000 (10:09 +0200)
commit12b58f4ed2a1b93f0eae84f308f6e0a143a533d4
tree89d75b8f505eb4df55d23b026a85889f6b1f0521
parentb382f44e98506bcb00acada0e30151a73e782a93
KVM: Assert that struct kvm_vcpu is always as offset zero

KVM implementations that wrap struct kvm_vcpu with a vendor specific
struct, e.g. struct vcpu_vmx, must place the vcpu member at offset 0,
otherwise the usercopy region intended to encompass struct kvm_vcpu_arch
will instead overlap random chunks of the vendor specific struct.
E.g. padding a large number of bytes before struct kvm_vcpu triggers
a usercopy warn when running with CONFIG_HARDENED_USERCOPY=y.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/powerpc/kvm/e500.c
arch/x86/kvm/svm.c
arch/x86/kvm/vmx/vmx.c