mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] KVM: MMU: Fix guest stuck during boot due to read/write emulation against GVA
@ 2017-08-11  5:59 Wanpeng Li
  2017-08-11  6:13 ` Paolo Bonzini
  0 siblings, 1 reply; 5+ messages in thread
From: Wanpeng Li @ 2017-08-11  5:59 UTC (permalink / raw)
  To: linux-kernel, kvm
  Cc: Paolo Bonzini, Radim Krčmář, Wanpeng Li, Brijesh Singh

From: Wanpeng Li <wanpeng.li@hotmail.com>

Commit c016004494b0 (KVM: x86: Avoid guest page table walk when gpa_available 
is set) avoids the page table walk when cr2 has already contained a valid GPA. 
However, that is not the truth if ept == 0 and shadow page table is used. In 
this scenario cr2 can just contains a valid GVA. The commit results in guest 
stuck during boot due to read/write emulation against GVA instead of GPA of 
the guest.

This patch fixes it by not setting the gpa_available flag if the shadow page table 
is used.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
---
 arch/x86/kvm/mmu.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 849312d..e4ce20b 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -3791,8 +3791,6 @@ int kvm_handle_page_fault(struct kvm_vcpu *vcpu, u64 error_code,
 
 		if (need_unprotect && kvm_event_needs_reinjection(vcpu))
 			kvm_mmu_unprotect_page_virt(vcpu, fault_address);
-		vcpu->arch.gpa_available = true;
-		vcpu->arch.gpa_val = fault_address;
 		r = kvm_mmu_page_fault(vcpu, fault_address, error_code, insn,
 				insn_len);
 		break;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-08-11  6:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-11  5:59 [PATCH] KVM: MMU: Fix guest stuck during boot due to read/write emulation against GVA Wanpeng Li
2017-08-11  6:13 ` Paolo Bonzini
2017-08-11  6:15   ` Wanpeng Li
2017-08-11  6:40   ` David Hildenbrand
2017-08-11  6:47     ` Wanpeng Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®