All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Juergen Gross <jgross@suse.com>,
	Dario Faggioli <dfaggioli@suse.com>,
	Luca Fancellu <luca.fancellu@arm.com>
Subject: [PATCH 1/2] xen/cpupool: Reject attempts to add a domain to CPUPOOLID_NONE
Date: Tue, 17 May 2022 20:41:12 +0100	[thread overview]
Message-ID: <20220517194113.2574-2-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <20220517194113.2574-1-andrew.cooper3@citrix.com>

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 <andrew.cooper3@citrix.com>
---
CC: Juergen Gross <jgross@suse.com>
CC: Dario Faggioli <dfaggioli@suse.com>
CC: Luca Fancellu <luca.fancellu@arm.com>
---
 xen/common/sched/cpupool.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/xen/common/sched/cpupool.c b/xen/common/sched/cpupool.c
index f6e3d97e5288..f1aa2db5f463 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 )
-- 
2.11.0



  reply	other threads:[~2022-05-17 19:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-17 19:41 [PATCH 0/2] Fix some problems with "arm/dom0less: assign dom0less guests to cpupools" Andrew Cooper
2022-05-17 19:41 ` Andrew Cooper [this message]
2022-05-18 10:24   ` [PATCH 1/2] xen/cpupool: Reject attempts to add a domain to CPUPOOLID_NONE Juergen Gross
2022-05-18 10:27   ` Luca Fancellu
2022-05-18 11:14     ` Andrew Cooper
2022-05-17 19:41 ` [PATCH 2/2] tools/ocaml: Fix stubs the introduction of domain_create.cpupool_id Andrew Cooper
2022-05-18  8:04   ` Christian Lindig
2022-05-18  9:51   ` Edwin Torok
2022-05-18 10:12     ` Andrew Cooper
2022-05-18 10:30       ` Luca Fancellu
2022-05-18 11:34         ` Andrew Cooper
2022-05-18 14:34           ` Luca Fancellu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220517194113.2574-2-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=dfaggioli@suse.com \
    --cc=jgross@suse.com \
    --cc=luca.fancellu@arm.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.