Skip to content

Commit a2c8e1d

Browse files
sean-jcgregkh
authored andcommitted
Revert "KVM: SVM: avoid infinite loop on NPF from bad address"
commit 31c2558 upstream. 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 <liam.merwick@oracle.com> Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson <seanjc@google.com> Reviewed-by: Liam Merwick <liam.merwick@oracle.com> Message-Id: <20220120010719.711476-3-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent abae88f commit a2c8e1d

2 files changed

Lines changed: 0 additions & 8 deletions

File tree

‎arch/x86/kvm/svm/svm.c‎

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

4149-
/*
4150-
* If RIP is invalid, go ahead with emulation which will cause an
4151-
* internal error exit.
4152-
*/
4153-
if (!kvm_vcpu_gfn_to_memslot(vcpu, kvm_rip_read(vcpu) >> PAGE_SHIFT))
4154-
return true;
4155-
41564149
cr4 = kvm_read_cr4(vcpu);
41574150
smep = cr4 & X86_CR4_SMEP;
41584151
smap = cr4 & X86_CR4_SMAP;

‎virt/kvm/kvm_main.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1691,7 +1691,6 @@ struct kvm_memory_slot *kvm_vcpu_gfn_to_memslot(struct kvm_vcpu *vcpu, gfn_t gfn
16911691
{
16921692
return __gfn_to_memslot(kvm_vcpu_memslots(vcpu), gfn);
16931693
}
1694-
EXPORT_SYMBOL_GPL(kvm_vcpu_gfn_to_memslot);
16951694

16961695
bool kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn)
16971696
{

0 commit comments

Comments
 (0)