Skip to content

Commit 31c2558

Browse files
sean-jcbonzini
authored andcommitted
Revert "KVM: SVM: avoid infinite loop on NPF from bad address"
Revert a completely broken check on an "invalid" RIP in SVM's workaround for the DecodeAssists SMAP errata. kvm_vcpu_gfn_to_memslot() obviously expects a gfn, i.e. operates in the guest physical address space, whereas RIP is a virtual (not even linear) address. The "fix" worked for the problematic KVM selftest because the test identity mapped RIP. Fully revert the hack instead of trying to translate RIP to a GPA, as the non-SEV case is now handled earlier, and KVM cannot access guest page tables to translate RIP. This reverts commit e72436b. Fixes: e72436b ("KVM: SVM: avoid infinite loop on NPF from bad address") Reported-by: Liam Merwick <[email protected]> Cc: [email protected] Signed-off-by: Sean Christopherson <[email protected]> Reviewed-by: Liam Merwick <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 55467fc commit 31c2558

File tree

2 files changed

+0
-8
lines changed

2 files changed

+0
-8
lines changed

arch/x86/kvm/svm/svm.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4312,13 +4312,6 @@ static bool svm_can_emulate_instruction(struct kvm_vcpu *vcpu, void *insn, int i
43124312
if (likely(!insn || insn_len))
43134313
return true;
43144314

4315-
/*
4316-
* If RIP is invalid, go ahead with emulation which will cause an
4317-
* internal error exit.
4318-
*/
4319-
if (!kvm_vcpu_gfn_to_memslot(vcpu, kvm_rip_read(vcpu) >> PAGE_SHIFT))
4320-
return true;
4321-
43224315
cr4 = kvm_read_cr4(vcpu);
43234316
smep = cr4 & X86_CR4_SMEP;
43244317
smap = cr4 & X86_CR4_SMAP;

virt/kvm/kvm_main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2248,7 +2248,6 @@ struct kvm_memory_slot *kvm_vcpu_gfn_to_memslot(struct kvm_vcpu *vcpu, gfn_t gfn
22482248

22492249
return NULL;
22502250
}
2251-
EXPORT_SYMBOL_GPL(kvm_vcpu_gfn_to_memslot);
22522251

22532252
bool kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn)
22542253
{

0 commit comments

Comments
 (0)