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] Handle the possibility that FXRSTOR may fault by silentl

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Handle the possibility that FXRSTOR may fault by silently clearing
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Thu, 28 Apr 2005 18:26:25 +0000
Delivery-date: Thu, 28 Apr 2005 19:04:18 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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 Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1394, 2005/04/28 19:26:25+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Handle the possibility that FXRSTOR may fault by silently clearing
        the data area that it is restoring from. This may occur if control
        tools reload a saved VM image without adequate checking, for example.
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 i387.c |   28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)


diff -Nru a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
--- a/xen/arch/x86/i387.c       2005-04-28 15:04:43 -04:00
+++ b/xen/arch/x86/i387.c       2005-04-28 15:04:43 -04:00
@@ -46,10 +46,34 @@
 
 void restore_fpu(struct exec_domain *tsk)
 {
+    /*
+     * FXRSTOR can fault if passed a corrupted data block. We handle this
+     * possibility, which may occur if the block was passed to us by control
+     * tools, by silently clearing the block.
+     */
     if ( cpu_has_fxsr )
         __asm__ __volatile__ (
-            "fxrstor %0"
-            : : "m" (tsk->arch.guest_context.fpu_ctxt) );
+            "1: fxrstor %0            \n"
+            ".section .fixup,\"ax\"   \n"
+            "2: push %%"__OP"ax       \n"
+            "   push %%"__OP"cx       \n"
+            "   push %%"__OP"di       \n"
+            "   lea  %0,%%"__OP"di    \n"
+            "   mov  %1,%%ecx         \n"
+            "   xor  %%eax,%%eax      \n"
+            "   rep ; stosl           \n"
+            "   pop  %%"__OP"di       \n"
+            "   pop  %%"__OP"cx       \n"
+            "   pop  %%"__OP"ax       \n"
+            "   jmp  1b               \n"
+            ".previous                \n"
+            ".section __ex_table,\"a\"\n"
+            "   "__FIXUP_ALIGN"       \n"
+            "   "__FIXUP_WORD" 1b,2b  \n"
+            ".previous                \n"
+            : 
+            : "m" (tsk->arch.guest_context.fpu_ctxt),
+              "i" (sizeof(tsk->arch.guest_context.fpu_ctxt)/4) );
     else
         __asm__ __volatile__ (
             "frstor %0"

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Handle the possibility that FXRSTOR may fault by silently clearing, BitKeeper Bot <=