Fir direct maps, root_gfn or cr3 are meaningless.  This hasn't bitten us
because no sane guest sets cr3 outside its own memory even in real mode.

Signed-off-by: Avi Kivity <[email protected]>
---
 arch/x86/kvm/mmu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 6e925b3..e3acc9e 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2083,7 +2083,7 @@ static int mmu_alloc_roots(struct kvm_vcpu *vcpu)
                } else
                        root_gfn = vcpu->arch.cr3 >> PAGE_SHIFT;
 
-               if (mmu_check_root(vcpu, root_gfn))
+               if (!direct && mmu_check_root(vcpu, root_gfn))
                        return 1;
                sp = kvm_mmu_get_page(vcpu, root_gfn, i << 30,
                                      PT32_ROOT_LEVEL, direct,
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to