[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Fix cpu_affinity memcpy() (bytes not longs!) add add a better
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID 821368442403cb9110f466a9c7c2c9849bef9733 # Parent 08d2a74dce81b7d7d29ae5753d7539e2c837afd4 Fix cpu_affinity memcpy() (bytes not longs!) add add a better affinity map sanity check to avoid blowing up Xen if no online cpu is included in the map. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> diff -r 08d2a74dce81 -r 821368442403 xen/common/dom0_ops.c --- a/xen/common/dom0_ops.c Thu Jan 12 10:37:10 2006 +++ b/xen/common/dom0_ops.c Thu Jan 12 11:45:49 2006 @@ -323,7 +323,7 @@ new_affinity = v->cpu_affinity; memcpy(cpus_addr(new_affinity), &op->u.setvcpuaffinity.cpumap, - min((int)BITS_TO_LONGS(NR_CPUS), + min((int)(BITS_TO_LONGS(NR_CPUS) * sizeof(long)), (int)sizeof(op->u.setvcpuaffinity.cpumap))); ret = vcpu_set_affinity(v, &new_affinity); @@ -501,7 +501,7 @@ op->u.getvcpuinfo.cpumap = 0; memcpy(&op->u.getvcpuinfo.cpumap, cpus_addr(v->cpu_affinity), - min((int)BITS_TO_LONGS(NR_CPUS), + min((int)(BITS_TO_LONGS(NR_CPUS) * sizeof(long)), (int)sizeof(op->u.getvcpuinfo.cpumap))); ret = 0; diff -r 08d2a74dce81 -r 821368442403 xen/common/schedule.c --- a/xen/common/schedule.c Thu Jan 12 10:37:10 2006 +++ b/xen/common/schedule.c Thu Jan 12 11:45:49 2006 @@ -207,7 +207,10 @@ int vcpu_set_affinity(struct vcpu *v, cpumask_t *affinity) { - if ( cpus_empty(*affinity) ) + cpumask_t online_affinity; + + cpus_and(online_affinity, *affinity, cpu_online_map); + if ( cpus_empty(online_affinity) ) return -EINVAL; return SCHED_OP(set_affinity, v, affinity); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |