From: Andrew Cooper Date: Tue, 17 May 2022 18:42:07 +0000 (+0100) Subject: xen/cpupool: Reject attempts to add a domain to CPUPOOLID_NONE X-Git-Tag: archive/raspbian/4.17.0-1+rpi1^2~33^2~639 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=2fa561c5d3317bb4b0d6b476800ff9ac281aab3c;p=xen.git xen/cpupool: Reject attempts to add a domain to CPUPOOLID_NONE c/s cfc52148444f ("xen/domain: Reduce the quantity of initialisation for system domains") removed the path in domain_create() which called sched_init_domain() with CPUPOOLID_NONE for system domains. Arguably, that changeset should have cleaned up this path too. However, c/s 92ea9c54fc81 ("arm/dom0less: assign dom0less guests to cpupools") changed domain_create() from using a hardcoded poolid of 0, to using a value passed by the toolstack. While CPUPOOLID_NONE is an internal constant, userspace can pass -1 for the cpupool_id parameter and attempt to construct a real domain using default ops, which at a minimum will fail the assertion in dom_scheduler(). Fixes: 92ea9c54fc81 ("arm/dom0less: assign dom0less guests to cpupools") Signed-off-by: Andrew Cooper Reviewed-by: Juergen Gross Reviewed-by: Luca Fancellu Tested-by: Luca Fancellu --- diff --git a/xen/common/sched/cpupool.c b/xen/common/sched/cpupool.c index f6e3d97e52..f1aa2db5f4 100644 --- a/xen/common/sched/cpupool.c +++ b/xen/common/sched/cpupool.c @@ -619,8 +619,6 @@ int cpupool_add_domain(struct domain *d, unsigned int poolid) int rc; int n_dom = 0; - if ( poolid == CPUPOOLID_NONE ) - return 0; spin_lock(&cpupool_lock); c = cpupool_find_by_id(poolid); if ( c == NULL )