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

[xen master] xen/sched: fix adding offline cpu to cpupool



commit 06e8d65d33896aa90f5b6d9b2bce7f11433b33c9
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Tue Dec 5 09:57:38 2023 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Dec 5 09:57:38 2023 +0100

    xen/sched: fix adding offline cpu to cpupool
    
    Trying to add an offline cpu to a cpupool can crash the hypervisor,
    as the probably non-existing percpu area of the cpu is accessed before
    the availability of the cpu is being tested. This can happen in case
    the cpupool's granularity is "core" or "socket".
    
    Fix that by testing the cpu to be online.
    
    Fixes: cb563d7665f2 ("xen/sched: support core scheduling for moving cpus 
to/from cpupools")
    Reported-by: René Winther Højgaard <renewin@xxxxxxxxx>
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/common/sched/cpupool.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/common/sched/cpupool.c b/xen/common/sched/cpupool.c
index 2e094b0cfa..ad8f608462 100644
--- a/xen/common/sched/cpupool.c
+++ b/xen/common/sched/cpupool.c
@@ -892,6 +892,8 @@ int cpupool_do_sysctl(struct xen_sysctl_cpupool_op *op)
         if ( cpu >= nr_cpu_ids )
             goto addcpu_out;
         ret = -ENODEV;
+        if ( !cpu_online(cpu) )
+            goto addcpu_out;
         cpus = sched_get_opt_cpumask(c->gran, cpu);
         if ( !cpumask_subset(cpus, &cpupool_free_cpus) ||
              cpumask_intersects(cpus, &cpupool_locked_cpus) )
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.