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

[Xen-changelog] [xen-3.0.3-testing] [XEN] Fix i386 hypercall code to always create shadow



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1159440453 -3600
# Node ID c40ea583941c91e4f1eff573497ab9e37424b966
# Parent  88418d7f22f2021daa5f7d4041dde6b22d84cada
[XEN] Fix i386 hypercall code to always create shadow
parameters. Arguments on stack can be clobbered by
callee, since it owns them. But we require this doesn't
happen when we create hypercall continuations. Hence the
need to copy.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/x86_32/entry.S |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff -r 88418d7f22f2 -r c40ea583941c xen/arch/x86/x86_32/entry.S
--- a/xen/arch/x86/x86_32/entry.S       Thu Sep 28 11:25:15 2006 +0100
+++ b/xen/arch/x86/x86_32/entry.S       Thu Sep 28 11:47:33 2006 +0100
@@ -175,7 +175,7 @@ ENTRY(hypercall)
         jae   bad_hypercall
         PERFC_INCR(PERFC_hypercalls, %eax)
 #ifndef NDEBUG
-        /* Deliberately corrupt parameter regs not used by this hypercall. */
+        /* Create shadow parameters and corrupt those not used by this call. */
         pushl %eax
         pushl UREGS_eip+4(%esp)
         pushl 28(%esp) # EBP
@@ -192,11 +192,23 @@ ENTRY(hypercall)
         movl  $0xDEADBEEF,%eax
         rep   stosl
         movl  %esi,%eax
+#else
+        /* 
+         * We need shadow parameters even on non-debug builds. We depend on the
+         * original versions not being clobbered (needed to create a hypercall
+         * continuation). But that isn't guaranteed by the function-call ABI.
+         */ 
+        pushl 20(%esp) # EBP
+        pushl 20(%esp) # EDI
+        pushl 20(%esp) # ESI
+        pushl 20(%esp) # EDX
+        pushl 20(%esp) # ECX
+        pushl 20(%esp) # EBX
 #endif
         call *hypercall_table(,%eax,4)
+        addl  $24,%esp     # Discard the shadow parameters
 #ifndef NDEBUG
-        /* Deliberately corrupt parameter regs used by this hypercall. */
-        addl  $24,%esp     # Shadow parameters
+        /* Deliberately corrupt real parameter regs used by this hypercall. */
         popl  %ecx         # Shadow EIP
         cmpl  %ecx,UREGS_eip+4(%esp)
         popl  %ecx         # Shadow hypercall index

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


 


Rackspace

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