Skip to content

Commit 9c19129

Browse files
committed
KVM: x86: Store gpa as gpa_t, not unsigned long, when unprotecting for retry
Store the gpa used to unprotect the faulting gfn for retry as a gpa_t, not an unsigned long. This fixes a bug where 32-bit KVM would unprotect and retry the wrong gfn if the gpa had bits 63:32!=0. In practice, this bug is functionally benign, as unprotecting the wrong gfn is purely a performance issue (thanks to the anti-infinite-loop logic). And of course, almost no one runs 32-bit KVM these days. Reviewed-by: Yuan Yao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 019f3f8 commit 9c19129

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/x86/kvm/x86.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8932,7 +8932,8 @@ static bool retry_instruction(struct x86_emulate_ctxt *ctxt,
89328932
gpa_t cr2_or_gpa, int emulation_type)
89338933
{
89348934
struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt);
8935-
unsigned long last_retry_eip, last_retry_addr, gpa = cr2_or_gpa;
8935+
unsigned long last_retry_eip, last_retry_addr;
8936+
gpa_t gpa = cr2_or_gpa;
89368937

89378938
last_retry_eip = vcpu->arch.last_retry_eip;
89388939
last_retry_addr = vcpu->arch.last_retry_addr;

0 commit comments

Comments
 (0)