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

[Xen-changelog] [xen-unstable] Correct 32on64 handling of VCPUOP_register_runstate_memory_area. We



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
# Date 1180103332 -3600
# Node ID 88e41a91301c109b99443db3a4bf3c8e6bbad042
# Parent  f2d2d5f18543de04191c1f5e22471e74d8767147
Correct 32on64 handling of VCPUOP_register_runstate_memory_area.  We
were copying too many bytes from the guest so the test for
area.addr.h.c != area.addr.p was failing.

Added a WARN_ON to the kernel to catch this case. It would be a BUG_ON
but this would break the new kernel on older hypervisors and the only
real problem is that stolen time is not updated, which we can live
with.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c |    4 +++-
 linux-2.6-xen-sparse/arch/ia64/kernel/time.c     |    4 +++-
 xen/arch/x86/x86_64/domain.c                     |    4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff -r f2d2d5f18543 -r 88e41a91301c 
linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c  Fri May 25 13:41:01 
2007 +0100
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c  Fri May 25 15:28:52 
2007 +0100
@@ -732,11 +732,13 @@ static void init_missing_ticks_accountin
 {
        struct vcpu_register_runstate_memory_area area;
        struct vcpu_runstate_info *runstate = &per_cpu(runstate, cpu);
+       int rc;
 
        memset(runstate, 0, sizeof(*runstate));
 
        area.addr.v = runstate;
-       HYPERVISOR_vcpu_op(VCPUOP_register_runstate_memory_area, cpu, &area);
+       rc = HYPERVISOR_vcpu_op(VCPUOP_register_runstate_memory_area, cpu, 
&area);
+       WARN_ON(rc && rc != -ENOSYS);
 
        per_cpu(processed_blocked_time, cpu) =
                runstate->time[RUNSTATE_blocked];
diff -r f2d2d5f18543 -r 88e41a91301c 
linux-2.6-xen-sparse/arch/ia64/kernel/time.c
--- a/linux-2.6-xen-sparse/arch/ia64/kernel/time.c      Fri May 25 13:41:01 
2007 +0100
+++ b/linux-2.6-xen-sparse/arch/ia64/kernel/time.c      Fri May 25 15:28:52 
2007 +0100
@@ -257,11 +257,13 @@ static void init_missing_ticks_accountin
 {
        struct vcpu_register_runstate_memory_area area;
        struct vcpu_runstate_info *runstate = &per_cpu(runstate, cpu);
+       int rc;
 
        memset(runstate, 0, sizeof(*runstate));
 
        area.addr.v = runstate;
-       HYPERVISOR_vcpu_op(VCPUOP_register_runstate_memory_area, cpu, &area);
+       rc = HYPERVISOR_vcpu_op(VCPUOP_register_runstate_memory_area, cpu, 
&area);
+       WARN_ON(rc && rc != -ENOSYS);
 
        per_cpu(processed_blocked_time, cpu) = runstate->time[RUNSTATE_blocked];
        per_cpu(processed_stolen_time, cpu) = runstate->time[RUNSTATE_runnable]
diff -r f2d2d5f18543 -r 88e41a91301c xen/arch/x86/x86_64/domain.c
--- a/xen/arch/x86/x86_64/domain.c      Fri May 25 13:41:01 2007 +0100
+++ b/xen/arch/x86/x86_64/domain.c      Fri May 25 15:28:52 2007 +0100
@@ -22,8 +22,10 @@ arch_compat_vcpu_op(
         struct compat_vcpu_register_runstate_memory_area area;
         struct compat_vcpu_runstate_info info;
 
+        area.addr.p = 0;
+
         rc = -EFAULT;
-        if ( copy_from_guest(&area, arg, 1) )
+        if ( copy_from_guest(&area.addr.h, arg, 1) )
             break;
 
         if ( area.addr.h.c != area.addr.p ||

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