[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH XTF] don't overrun memory object



Using MOVUPS on an 8-byte quantity is wrong. There's no need for memory
accesses in any of the probe_*() functions anyway - switch them all to
insns without any operands or with register ones.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/tests/fpu-exception-emulation/main.c
+++ b/tests/fpu-exception-emulation/main.c
@@ -52,7 +52,6 @@ struct test_cfg
     exinfo_t fault;
 };
 
-static unsigned long zero;
 static unsigned long default_cr0;
 
 /**
@@ -78,11 +77,10 @@ exinfo_t probe_x87(bool force)
     asm volatile ("test %[fep], %[fep];"
                   "jz 1f;"
                   _ASM_XEN_FEP
-                  "1: fildq %[ptr]; 2:"
+                  "1: fnop; 2:"
                   _ASM_EXTABLE_HANDLER(1b, 2b, ex_record_fault_eax)
                   : "+a" (fault)
-                  : [ptr] "m" (zero),
-                    [fep] "q" (force));
+                  : [fep] "q" (force));
 
     return fault;
 }
@@ -142,11 +140,10 @@ exinfo_t probe_mmx(bool force)
     asm volatile ("test %[fep], %[fep];"
                   "jz 1f;"
                   _ASM_XEN_FEP
-                  "1: movq %[ptr], %%mm0; 2:"
+                  "1: pxor %%mm0, %%mm0; 2:"
                   _ASM_EXTABLE_HANDLER(1b, 2b, ex_record_fault_eax)
                   : "+a" (fault)
-                  : [ptr] "m" (zero),
-                    [fep] "q" (force));
+                  : [fep] "q" (force));
 
     return fault;
 }
@@ -158,11 +155,10 @@ exinfo_t probe_sse(bool force)
     asm volatile ("test %[fep], %[fep];"
                   "jz 1f;"
                   _ASM_XEN_FEP
-                  "1: movups %[ptr], %%xmm0; 2:"
+                  "1: movups %%xmm0, %%xmm0; 2:"
                   _ASM_EXTABLE_HANDLER(1b, 2b, ex_record_fault_eax)
                   : "+a" (fault)
-                  : [ptr] "m" (zero),
-                    [fep] "q" (force));
+                  : [fep] "q" (force));
 
     return fault;
 }



Attachment: xtf-FPU-exn.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.