提交 d6613161 编写于 作者: S Sean Christopherson 提交者: Zheng Zengkai

KVM: nVMX: Truncate base/index GPR value on address calc in !64-bit

stable inclusion
from stable-5.10.37
commit a947f95b6b3a921358f05bd8989eb22ac87ac6d4
bugzilla: 51868
CVE: NA

--------------------------------

commit 82277eee upstream.

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: 064aea77 ("KVM: nVMX: Decoding memory operands of VMX instructions")
Cc: stable@vger.kernel.org
Signed-off-by: NSean Christopherson <seanjc@google.com>
Message-Id: <20210422022128.3464144-7-seanjc@google.com>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 38dbe537
...@@ -4613,9 +4613,9 @@ int get_vmx_mem_address(struct kvm_vcpu *vcpu, unsigned long exit_qualification, ...@@ -4613,9 +4613,9 @@ int get_vmx_mem_address(struct kvm_vcpu *vcpu, unsigned long exit_qualification,
else if (addr_size == 0) else if (addr_size == 0)
off = (gva_t)sign_extend64(off, 15); off = (gva_t)sign_extend64(off, 15);
if (base_is_valid) if (base_is_valid)
off += kvm_register_read(vcpu, base_reg); off += kvm_register_readl(vcpu, base_reg);
if (index_is_valid) if (index_is_valid)
off += kvm_register_read(vcpu, index_reg) << scaling; off += kvm_register_readl(vcpu, index_reg) << scaling;
vmx_get_segment(vcpu, &s, seg_reg); vmx_get_segment(vcpu, &s, seg_reg);
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册