public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* KVM: MMU: handle invalid root_hpa at __direct_map
@ 2013-12-19 17:28 Marcelo Tosatti
  2013-12-20  9:15 ` Xiao Guangrong
  2013-12-20 18:22 ` Paolo Bonzini
  0 siblings, 2 replies; 8+ messages in thread
From: Marcelo Tosatti @ 2013-12-19 17:28 UTC (permalink / raw)
  To: kvm-devel; +Cc: Paolo Bonzini, Xiao Guangrong


It is possible for __direct_map to be called on invalid root_hpa
(-1), two examples:

1) try_async_pf -> can_do_async_pf
    -> vmx_interrupt_allowed -> nested_vmx_vmexit
2) vmx_handle_exit -> vmx_interrupt_allowed -> nested_vmx_vmexit

Then to load_vmcs12_host_state and kvm_mmu_reset_context.

Check for this possibility, let fault exception be regenerated.

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=924916

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>


diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 40772ef..31a5702 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2659,6 +2659,9 @@ static int __direct_map(struct kvm_vcpu *vcpu, gpa_t v, int write,
 	int emulate = 0;
 	gfn_t pseudo_gfn;
 
+	if (!VALID_PAGE(vcpu->arch.mmu.root_hpa))
+		return 0;
+
 	for_each_shadow_entry(vcpu, (u64)gfn << PAGE_SHIFT, iterator) {
 		if (iterator.level == level) {
 			mmu_set_spte(vcpu, iterator.sptep, ACC_ALL,


^ permalink raw reply related	[flat|nested] 8+ messages in thread
[parent not found: <CADs-y4TpXQ0zvg4p-_fkKkMDbEiho89hzhkSAYMEVAxbp63XzQ@mail.gmail.com>]

end of thread, other threads:[~2014-01-17 21:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-19 17:28 KVM: MMU: handle invalid root_hpa at __direct_map Marcelo Tosatti
2013-12-20  9:15 ` Xiao Guangrong
2013-12-20 12:59   ` Marcelo Tosatti
2013-12-20 18:22 ` Paolo Bonzini
     [not found] <CADs-y4TpXQ0zvg4p-_fkKkMDbEiho89hzhkSAYMEVAxbp63XzQ@mail.gmail.com>
2013-12-22 14:56 ` Marcelo Tosatti
2013-12-27 19:43   ` Marcelo Tosatti
2014-01-16 23:17     ` Rom Freiman
2014-01-17 21:39       ` Marcelo Tosatti

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