]>
Commit | Line | Data |
---|---|---|
7d777456 GKH |
1 | From 51e00c5c8ddedce8030521bf8645d90b82854980 Mon Sep 17 00:00:00 2001 |
2 | From: Marcelo Tosatti <mtosatti@redhat.com> | |
3 | Date: Fri, 28 May 2010 09:44:59 -0300 | |
4 | Subject: KVM: MMU: invalidate and flush on spte small->large page size change | |
5 | ||
6 | Always invalidate spte and flush TLBs when changing page size, to make | |
7 | sure different sized translations for the same address are never cached | |
8 | in a CPU's TLB. | |
9 | ||
10 | Currently the only case where this occurs is when a non-leaf spte pointer is | |
11 | overwritten by a leaf, large spte entry. This can happen after dirty | |
12 | logging is disabled on a memslot, for example. | |
13 | ||
14 | Noticed by Andrea. | |
15 | ||
16 | KVM-Stable-Tag | |
17 | Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> | |
18 | Signed-off-by: Avi Kivity <avi@redhat.com> | |
19 | (cherry picked from commit 3be2264be3c00865116f997dc53ebcc90fe7fc4b) | |
20 | --- | |
21 | arch/x86/kvm/mmu.c | 2 ++ | |
22 | 1 file changed, 2 insertions(+) | |
23 | ||
24 | --- a/arch/x86/kvm/mmu.c | |
25 | +++ b/arch/x86/kvm/mmu.c | |
26 | @@ -1901,6 +1901,8 @@ static void mmu_set_spte(struct kvm_vcpu | |
27 | ||
28 | child = page_header(pte & PT64_BASE_ADDR_MASK); | |
29 | mmu_page_remove_parent_pte(child, sptep); | |
30 | + __set_spte(sptep, shadow_trap_nonpresent_pte); | |
31 | + kvm_flush_remote_tlbs(vcpu->kvm); | |
32 | } else if (pfn != spte_to_pfn(*sptep)) { | |
33 | pgprintk("hfn old %lx new %lx\n", | |
34 | spte_to_pfn(*sptep), pfn); |