KVM: SVM: Truncate GPR value for DR and CR accesses in !64-bit mode
authorSean Christopherson <seanjc@google.com>
Thu, 22 Apr 2021 02:21:22 +0000 (19:21 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 26 Apr 2021 09:27:11 +0000 (05:27 -0400)
commit0884335a2e653b8a045083aa1d57ce74269ac81d
treefb79c7aa0cdafafb12eb993018e34fed169f7d13
parent886bbcc7a523b8d4fac60f1015d2e0fcad50db82
KVM: SVM: Truncate GPR value for DR and CR accesses in !64-bit mode

Drop bits 63:32 on loads/stores to/from DRs and CRs when the vCPU is not
in 64-bit mode.  The APM states bits 63:32 are dropped for both DRs and
CRs:

  In 64-bit mode, the operand size is fixed at 64 bits without the need
  for a REX prefix. In non-64-bit mode, the operand size is fixed at 32
  bits and the upper 32 bits of the destination are forced to 0.

Fixes: 7ff76d58a9dc ("KVM: SVM: enhance MOV CR intercept handler")
Fixes: cae3797a4639 ("KVM: SVM: enhance mov DR intercept handler")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210422022128.3464144-4-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/svm.c