WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] SVM: handle page faults in emulated instr

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] SVM: handle page faults in emulated instruction fetches
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 20 Mar 2008 05:40:16 -0700
Delivery-date: Thu, 20 Mar 2008 05:40:54 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1205753990 0
# Node ID 8325f200e19414d998b7625f2e3cf786a6d3d3a3
# Parent  f82baf1755ac6b4e1b77a35f160d26d30a094a1c
SVM: handle page faults in emulated instruction fetches

Deal with failures in hvm_copy_from_guest_virt when fetching
instructions in the various SVM emulation paths.  Since we know that
the instruction was fetchable by the hardware, we can usually just
return from the VMEXIT and try again; whatever caused us to fail will
cause the hardware to fail next time and we'll get the correct exit
code.

Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
---
 xen/arch/x86/hvm/svm/emulate.c |    4 +++-
 xen/arch/x86/hvm/svm/svm.c     |    9 ++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff -r f82baf1755ac -r 8325f200e194 xen/arch/x86/hvm/svm/emulate.c
--- a/xen/arch/x86/hvm/svm/emulate.c    Mon Mar 17 11:18:06 2008 +0000
+++ b/xen/arch/x86/hvm/svm/emulate.c    Mon Mar 17 11:39:50 2008 +0000
@@ -117,7 +117,9 @@ int __get_instruction_length_from_list(s
     }
     else
     {
-        inst_copy_from_guest(buffer, svm_rip2pointer(v), MAX_INST_LEN);
+        if ( inst_copy_from_guest(buffer, svm_rip2pointer(v), MAX_INST_LEN)
+             != MAX_INST_LEN )
+            return 0;
         buf = buffer;
     }
 
diff -r f82baf1755ac -r 8325f200e194 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Mon Mar 17 11:18:06 2008 +0000
+++ b/xen/arch/x86/hvm/svm/svm.c        Mon Mar 17 11:39:50 2008 +0000
@@ -943,6 +943,10 @@ static void svm_vmexit_do_cpuid(struct c
 {
     unsigned int eax, ebx, ecx, edx, inst_len;
 
+    inst_len = __get_instruction_length(current, INSTR_CPUID, NULL);
+    if ( inst_len == 0 ) 
+        return;
+
     eax = regs->eax;
     ebx = regs->ebx;
     ecx = regs->ecx;
@@ -955,7 +959,6 @@ static void svm_vmexit_do_cpuid(struct c
     regs->ecx = ecx;
     regs->edx = edx;
 
-    inst_len = __get_instruction_length(current, INSTR_CPUID, NULL);
     __update_guest_eip(regs, inst_len);
 }
 
@@ -1166,6 +1169,8 @@ static void svm_vmexit_do_hlt(struct vmc
     unsigned int inst_len;
 
     inst_len = __get_instruction_length(curr, INSTR_HLT, NULL);
+    if ( inst_len == 0 )
+        return 0;
     __update_guest_eip(regs, inst_len);
 
     /* Check for pending exception or new interrupt. */
@@ -1354,6 +1359,8 @@ asmlinkage void svm_vmexit_handler(struc
 
     case VMEXIT_VMMCALL:
         inst_len = __get_instruction_length(v, INSTR_VMCALL, NULL);
+        if ( inst_len == 0 )
+            break;
         HVMTRACE_1D(VMMCALL, v, regs->eax);
         rc = hvm_do_hypercall(regs);
         if ( rc != HVM_HCALL_preempted )

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] SVM: handle page faults in emulated instruction fetches, Xen patchbot-unstable <=