From: Marcelo Tosatti Date: Fri, 28 May 2010 12:44:59 +0000 (-0300) Subject: KVM: MMU: invalidate and flush on spte small->large page size change X-Git-Tag: firefly_0821_release~10186^2~1297 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=05ae56ca1cd57e3b6fb57173e8f9e23f289880e9;p=firefly-linux-kernel-4.4.55.git KVM: MMU: invalidate and flush on spte small->large page size change Always invalidate spte and flush TLBs when changing page size, to make sure different sized translations for the same address are never cached in a CPU's TLB. Currently the only case where this occurs is when a non-leaf spte pointer is overwritten by a leaf, large spte entry. This can happen after dirty logging is disabled on a memslot, for example. Noticed by Andrea. KVM-Stable-Tag Signed-off-by: Marcelo Tosatti Signed-off-by: Avi Kivity (cherry picked from commit 3be2264be3c00865116f997dc53ebcc90fe7fc4b) --- diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index d5fc36cb4f05..fdf2e28f3bc6 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -1901,6 +1901,8 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *sptep, child = page_header(pte & PT64_BASE_ADDR_MASK); mmu_page_remove_parent_pte(child, sptep); + __set_spte(sptep, shadow_trap_nonpresent_pte); + kvm_flush_remote_tlbs(vcpu->kvm); } else if (pfn != spte_to_pfn(*sptep)) { pgprintk("hfn old %lx new %lx\n", spte_to_pfn(*sptep), pfn);