Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 3160499aacb81f6735941eb4c372d87a > files > 370

kvm-83-164.el5_5.30.src.rpm

From 45f2a890596185b497ee11a244f724d5a73fd09d Mon Sep 17 00:00:00 2001
From: Avi Kivity <avi@redhat.com>
Date: Mon, 3 May 2010 10:12:57 -0300
Subject: [PATCH 1/2] KVM: MMU: bail out pagewalk on kvm_read_guest error

RH-Author: Avi Kivity <avi@redhat.com>
Message-id: <patch-8957-clone-for-rhel55-rhel55>
Patchwork-id: 8977
O-Subject: [PATCH RHEL5.5 RHEL5.4.z] KVM: MMU: bail out pagewalk on
	kvm_read_guest error
Bugzilla: 596381
RH-Acked-by: Gleb Natapov <gleb@redhat.com>
RH-Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
RH-Acked-by: Juan Quintela <quintela@redhat.com>

From: Marcelo Tosatti <mtosatti@redhat.com>

Bugzilla: 588251
Upstream: a6085fbaf65

Exit the guest pagetable walk loop if reading gpte failed. Otherwise its
possible to enter an endless loop processing the previous present pte.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
---
 arch/x86/kvm/paging_tmpl.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 arch/x86/kvm/paging_tmpl.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index c1f05c2..3edb7c4 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -167,7 +167,8 @@ walk:
 		pgprintk("%s: table_gfn[%d] %lx\n", __func__,
 			 walker->level - 1, table_gfn);
 
-		kvm_read_guest(vcpu->kvm, pte_gpa, &pte, sizeof(pte));
+		if (kvm_read_guest(vcpu->kvm, pte_gpa, &pte, sizeof(pte)))
+			goto not_present;
 
 		if (!is_present_pte(pte))
 			goto not_present;
-- 
1.7.0.3