Skip to contentSkip to conversation

Fix HV to properly copy runstate info

PATCH RESEND In review Glauber de Oliveira Costa 2 participants 2 messages Oct 23, 2006

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 Fix HV to properly copy runstate info

Keir,

I guess this patch does the right thing regarding the copy of the runstate_memory_area without breaking the ABI.

Thanks,

Signature · 3 lines
Glauber de Oliveira Costa
Red Hat Inc.
"Free as in Freedom"
xen/arch/x86/domain.c renamed from xen/arch/x86/domain.c.old +4 -3
@@ -376,6 +376,7 @@ arch_do_vcpu_op(
     case VCPUOP_register_runstate_memory_area:
     {
         struct vcpu_register_runstate_memory_area area;
+        struct vcpu_runstate_info runstate;
 
         rc = -EFAULT;
         if ( copy_from_guest(&area, arg, 1) )
@@ -387,9 +388,9 @@ arch_do_vcpu_op(
         rc = 0;
         v->runstate_guest = area.addr.v;
 
-        if ( v == current )
-            __copy_to_user(v->runstate_guest, &v->runstate,
-                           sizeof(v->runstate));
+        vcpu_runstate_get(v,&runstate);
+        __copy_to_user(v->runstate_guest, &runstate,
+                       sizeof(runstate));
 
         break;
     }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

just saw a fix for it in changelog ;-)

nevermind.
However, isn't the check for vcpu == current also done inside vcpu_runstate_get() ?

Quoted 45 lines · Glauber de Oliveira Costa

Keir,

I guess this patch does the right thing regarding the copy of the runstate_memory_area without breaking the ABI.

Thanks,

--
Glauber de Oliveira Costa
Red Hat Inc.
"Free as in Freedom"

xen/arch/x86/domain.c 2006-10-20 15:08:46.000000000 -0300 renamed from xen/arch/x86/domain.c.old 2006-10-04 01:39:48.000000000 -0300 +4 -3
@@ -376,6 +376,7 @@ arch_do_vcpu_op(
     case VCPUOP_register_runstate_memory_area:
     {
         struct vcpu_register_runstate_memory_area area;
+        struct vcpu_runstate_info runstate;
 
         rc = -EFAULT;
         if ( copy_from_guest(&area, arg, 1) )
@@ -387,9 +388,9 @@ arch_do_vcpu_op(
         rc = 0;
         v->runstate_guest = area.addr.v;
 
-        if ( v == current )
-            __copy_to_user(v->runstate_guest, &v->runstate,
-                           sizeof(v->runstate));
+        vcpu_runstate_get(v,&runstate);
+        __copy_to_user(v->runstate_guest, &runstate,
+                       sizeof(runstate));
 
         break;
     }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Signature · 5 lines
Glauber de Oliveira Costa.
"Free as in Freedom"

Add your comments to GPLv3 at:
http://gplv3.fsf.org/comments/gplv3-draft-2.html