Skip to content

Commit 82277ee

Browse files
sean-jcbonzini
authored andcommitted
KVM: nVMX: Truncate base/index GPR value on address calc in !64-bit
Drop bits 63:32 of the base and/or index GPRs when calculating the effective address of a VMX instruction memory operand. Outside of 64-bit mode, memory encodings are strictly limited to E*X and below. Fixes: 064aea7 ("KVM: nVMX: Decoding memory operands of VMX instructions") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson <seanjc@google.com> Message-Id: <20210422022128.3464144-7-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent ee050a5 commit 82277ee

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎arch/x86/kvm/vmx/nested.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4619,9 +4619,9 @@ int get_vmx_mem_address(struct kvm_vcpu *vcpu, unsigned long exit_qualification,
46194619
else if (addr_size == 0)
46204620
off = (gva_t)sign_extend64(off, 15);
46214621
if (base_is_valid)
4622-
off += kvm_register_read(vcpu, base_reg);
4622+
off += kvm_register_readl(vcpu, base_reg);
46234623
if (index_is_valid)
4624-
off += kvm_register_read(vcpu, index_reg) << scaling;
4624+
off += kvm_register_readl(vcpu, index_reg) << scaling;
46254625
vmx_get_segment(vcpu, &s, seg_reg);
46264626

46274627
/*

0 commit comments

Comments
 (0)