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@xensource.com>
This commit is contained in:
Ian Campbell committed 2007-05-25 15:28:52 +01:00
1 parent f91feaa0fd
commit cf71bfc68e
3 files changed
+9 -3

No files matched your search

@@ -732,11 +732,13 @@ static void init_missing_ticks_accounting(int cpu)
{
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];
+3 -1
View File
@@ -257,11 +257,13 @@ static void init_missing_ticks_accounting(int cpu)
{
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]
+3 -1
View File
@@ -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 ||
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.