kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 1/9] KVM: MMU: fix forgot reserved bits check in speculative path
@ 2010-07-06 10:44 Xiao Guangrong
  2010-07-06 10:45 ` [PATCH v5 2/9] KVM: MMU: fix race between 'walk_addr' and 'fetch' Xiao Guangrong
                   ` (7 more replies)
  0 siblings, 8 replies; 42+ messages in thread
From: Xiao Guangrong @ 2010-07-06 10:44 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Marcelo Tosatti, LKML, KVM list

In the speculative path, we should check guest pte's reserved bits just as
the real processor does

Reported-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
---
 arch/x86/kvm/mmu.c         |    3 +++
 arch/x86/kvm/paging_tmpl.h |    3 ++-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 104756b..3dcd55d 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2781,6 +2781,9 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
 		break;
 	}
 
+	if (is_rsvd_bits_set(vcpu, gentry, PT_PAGE_TABLE_LEVEL))
+		gentry = 0;
+
 	mmu_guess_page_from_pte_write(vcpu, gpa, gentry);
 	spin_lock(&vcpu->kvm->mmu_lock);
 	if (atomic_read(&vcpu->kvm->arch.invlpg_counter) != invlpg_counter)
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index dfb2720..19f0077 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -628,7 +628,8 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,
 		pte_gpa = first_pte_gpa + i * sizeof(pt_element_t);
 
 		if (kvm_read_guest_atomic(vcpu->kvm, pte_gpa, &gpte,
-					  sizeof(pt_element_t)))
+					  sizeof(pt_element_t)) ||
+		      is_rsvd_bits_set(vcpu, gpte, PT_PAGE_TABLE_LEVEL))
 			return -EINVAL;
 
 		gfn = gpte_to_gfn(gpte);
-- 
1.6.1.2


^ permalink raw reply related	[flat|nested] 42+ messages in thread

end of thread, other threads:[~2010-07-13  7:45 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-06 10:44 [PATCH v5 1/9] KVM: MMU: fix forgot reserved bits check in speculative path Xiao Guangrong
2010-07-06 10:45 ` [PATCH v5 2/9] KVM: MMU: fix race between 'walk_addr' and 'fetch' Xiao Guangrong
2010-07-06 10:46   ` [PATCH v5 3/9] export __get_user_pages_fast() function Xiao Guangrong
2010-07-11 12:52   ` [PATCH v5 2/9] KVM: MMU: fix race between 'walk_addr' and 'fetch' Avi Kivity
2010-07-11 15:40     ` Avi Kivity
2010-07-06 10:47 ` [PATCH v5 4/9] KVM: MMU: introduce gfn_to_pfn_atomic() function Xiao Guangrong
2010-07-06 11:22   ` Gleb Natapov
2010-07-06 11:28     ` Xiao Guangrong
2010-07-09  1:34   ` Xiao Guangrong
2010-07-06 10:48 ` [PATCH v5 5/9] KVM: MMU: introduce gfn_to_page_many_atomic() function Xiao Guangrong
2010-07-11 12:59   ` Avi Kivity
2010-07-12  2:55     ` Xiao Guangrong
2010-07-12 12:28       ` Avi Kivity
2010-07-13  1:17         ` Xiao Guangrong
2010-07-06 10:49 ` [PATCH v5 6/9] KVM: MMU: introduce pte_prefetch_topup_memory_cache() Xiao Guangrong
2010-07-11 13:05   ` Avi Kivity
2010-07-12  3:05     ` Xiao Guangrong
2010-07-12 12:26       ` Avi Kivity
2010-07-13  1:16         ` Xiao Guangrong
2010-07-13  4:21           ` Avi Kivity
2010-07-13  4:25             ` Xiao Guangrong
2010-07-13  5:35               ` Avi Kivity
2010-07-13  5:48                 ` Xiao Guangrong
2010-07-13  6:05                   ` Avi Kivity
2010-07-13  6:10                     ` Xiao Guangrong
2010-07-13  6:29                       ` Avi Kivity
2010-07-13  6:52                         ` Xiao Guangrong
2010-07-13  7:45                           ` Avi Kivity
2010-07-06 10:50 ` [PATCH v5 7/9] KVM: MMU: prefetch ptes when intercepted guest #PF Xiao Guangrong
2010-07-06 10:51 ` [PATCH v5 8/9] KVM: MMU: combine guest pte read between fetch and pte prefetch Xiao Guangrong
2010-07-06 19:52   ` Marcelo Tosatti
2010-07-07  1:23     ` Xiao Guangrong
2010-07-07 13:07       ` Marcelo Tosatti
2010-07-07 13:11         ` Xiao Guangrong
2010-07-07 13:40           ` Marcelo Tosatti
2010-07-07 14:10             ` Xiao Guangrong
2010-07-07 15:30               ` Marcelo Tosatti
2010-07-06 10:52 ` [PATCH v5 9/9] KVM: MMU: trace " Xiao Guangrong
2010-07-11 12:24 ` [PATCH v5 1/9] KVM: MMU: fix forgot reserved bits check in speculative path Avi Kivity
2010-07-12  2:37   ` Xiao Guangrong
2010-07-12 13:15     ` Avi Kivity
2010-07-13  1:57       ` Xiao Guangrong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).