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

[Xen-changelog] [xen-unstable] Fix preemption of multicalls in compat mode.



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
# Date 1180522538 -3600
# Node ID 63211a8027fa994290e23be17f4de9ba3b3e953e
# Parent  c4f62fe631e4a5f7ff20ec7bab0a81cd97a14974
Fix preemption of multicalls in compat mode.

mcs->call (struct multicall_entry) always needs to be translated into
mcs->compat_call (struct compat_multicall_entry) when a multicall is
preempted in compat mode. Previously this translation only occured for
those hypercalls which explicitly called hypercall_xlat_continuation()
which doesn't cover all hypercalls which could potentially be
preempted.

Change hypercall_xlat_continuation() to only translate only the
hypercall arguments themselves and not the multicall_entry
layout. Translate the layout for all hypercalls in in
compat_multicall() instead.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
---
 xen/arch/x86/domain.c         |    9 ++++-----
 xen/common/compat/multicall.c |    7 +++++++
 xen/common/multicall.c        |    4 ++++
 3 files changed, 15 insertions(+), 5 deletions(-)

diff -r c4f62fe631e4 -r 63211a8027fa xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Wed May 30 10:47:05 2007 +0100
+++ b/xen/arch/x86/domain.c     Wed May 30 11:55:38 2007 +0100
@@ -1456,13 +1456,12 @@ int hypercall_xlat_continuation(unsigned
                 id = NULL;
             }
             if ( (mask & 1) && mcs->call.args[i] == nval )
+            {
+                mcs->call.args[i] = cval;
                 ++rc;
+            }
             else
-            {
-                cval = mcs->call.args[i];
-                BUG_ON(mcs->call.args[i] != cval);
-            }
-            mcs->compat_call.args[i] = cval;
+                BUG_ON(mcs->call.args[i] != (unsigned int)mcs->call.args[i]);
         }
     }
     else
diff -r c4f62fe631e4 -r 63211a8027fa xen/common/compat/multicall.c
--- a/xen/common/compat/multicall.c     Wed May 30 10:47:05 2007 +0100
+++ b/xen/common/compat/multicall.c     Wed May 30 11:55:38 2007 +0100
@@ -9,6 +9,13 @@
 #define COMPAT
 typedef int ret_t;
 #undef do_multicall_call
+
+static inline void xlat_multicall_entry(struct mc_state *mcs)
+{
+    int i;
+    for (i=0; i<6; i++)
+        mcs->compat_call.args[i] = mcs->call.args[i];
+}
 
 DEFINE_XEN_GUEST_HANDLE(multicall_entry_compat_t);
 #define multicall_entry      compat_multicall_entry
diff -r c4f62fe631e4 -r 63211a8027fa xen/common/multicall.c
--- a/xen/common/multicall.c    Wed May 30 10:47:05 2007 +0100
+++ b/xen/common/multicall.c    Wed May 30 11:55:38 2007 +0100
@@ -17,6 +17,7 @@
 #ifndef COMPAT
 DEFINE_PER_CPU(struct mc_state, mc_state);
 typedef long ret_t;
+#define xlat_multicall_entry(mcs)
 #endif
 
 ret_t
@@ -62,6 +63,9 @@ do_multicall(
 
         if ( test_bit(_MCSF_call_preempted, &mcs->flags) )
         {
+            /* Translate sub-call continuation to guest layout */
+            xlat_multicall_entry(mcs);
+
             /* Copy the sub-call continuation. */
             (void)__copy_to_guest(call_list, &mcs->call, 1);
             goto preempted;

_______________________________________________
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®.