diff options
author | Sean Christopherson <seanjc@google.com> | 2024-08-30 17:15:22 -0700 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2024-09-09 20:16:22 -0700 |
commit | 9c19129e535bfff85bdfcb5a804e19e5aae935b2 (patch) | |
tree | 7314f5fa442e646862a81392ac5664881cb25ef1 /arch/x86/kvm | |
parent | 019f3f84a40c88b68ca4d455306b92c20733e784 (diff) | |
download | linux-9c19129e535bfff85bdfcb5a804e19e5aae935b2.tar.gz linux-9c19129e535bfff85bdfcb5a804e19e5aae935b2.tar.bz2 linux-9c19129e535bfff85bdfcb5a804e19e5aae935b2.zip |
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 <yuan.yao@intel.com>
Link: https://lore.kernel.org/r/20240831001538.336683-8-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r-- | arch/x86/kvm/x86.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 760d455f77ac..d26e107225f7 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -8932,7 +8932,8 @@ static bool retry_instruction(struct x86_emulate_ctxt *ctxt, gpa_t cr2_or_gpa, int emulation_type) { struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt); - unsigned long last_retry_eip, last_retry_addr, gpa = cr2_or_gpa; + unsigned long last_retry_eip, last_retry_addr; + gpa_t gpa = cr2_or_gpa; last_retry_eip = vcpu->arch.last_retry_eip; last_retry_addr = vcpu->arch.last_retry_addr; |