From: Avi Kivity Date: Fri, 14 Jan 2011 12:10:18 +0000 (-0200) Subject: KVM: MMU: Fix incorrect direct gfn for unpaged mode shadow X-Git-Tag: v2.6.36.4~31 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e9d2581219cb776a9b6eeab9042584e9d5c3b046;p=karo-tx-linux.git KVM: MMU: Fix incorrect direct gfn for unpaged mode shadow commit c093b8b46c5f0dd12d799f0d6a3b579863df72f6 upstream. We use the physical address instead of the base gfn for the four PAE page directories we use in unpaged mode. When the guest accesses an address above 1GB that is backed by a large host page, a BUG_ON() in kvm_mmu_set_gfn() triggers. Resolves: https://bugzilla.kernel.org/show_bug.cgi?id=21962 Reported-and-tested-by: Nicolas Prochazka Signed-off-by: Avi Kivity Cc: Marcelo Tosatti Signed-off-by: Greg Kroah-Hartman --- diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 311f6dad8951..d856829134c4 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -2271,7 +2271,7 @@ static int mmu_alloc_roots(struct kvm_vcpu *vcpu) return 1; if (tdp_enabled) { direct = 1; - root_gfn = i << 30; + root_gfn = i << (30 - PAGE_SHIFT); } spin_lock(&vcpu->kvm->mmu_lock); kvm_mmu_free_some_pages(vcpu);