[PATCH] xen/domain: Initialise the domain handle before inserting into the domlist

Andrew Cooper posted 1 patch 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20250307164637.3087855-1-andrew.cooper3@citrix.com
xen/common/domain.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] xen/domain: Initialise the domain handle before inserting into the domlist
Posted by Andrew Cooper 11 months ago
As soon as the the domain is in the domlist, it can be queried via various
means, ahead of being fully constructed.  Ensure it the UUID give by the
toolstack is in place ahead of this.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Anthony PERARD <anthony.perard@vates.tech>
CC: Michal Orzel <michal.orzel@amd.com>
CC: Jan Beulich <jbeulich@suse.com>
CC: Julien Grall <julien@xen.org>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Stefano Stabellini <sstabellini@kernel.org>

Quite possibly benign right now, but the change is appropriate nonetheless.
---
 xen/common/domain.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index b887c60ecc1d..8d0125bb8fd0 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -901,6 +901,8 @@ struct domain *domain_create(domid_t domid,
      */
     ASSERT(config);
 
+    memcpy(d->handle, config->handle, sizeof(d->handle));
+
 #ifdef CONFIG_HAS_PIRQ
     if ( !is_hardware_domain(d) )
         d->nr_pirqs = nr_static_irqs + extra_domU_irqs;
@@ -962,7 +964,6 @@ struct domain *domain_create(domid_t domid,
     domlist_insert(d);
 
     domain_changed_state(d);
-    memcpy(d->handle, config->handle, sizeof(d->handle));
 
     return d;
 
-- 
2.39.5


Re: [PATCH] xen/domain: Initialise the domain handle before inserting into the domlist
Posted by Jan Beulich 11 months ago
On 07.03.2025 17:46, Andrew Cooper wrote:
> As soon as the the domain is in the domlist, it can be queried via various
> means, ahead of being fully constructed.  Ensure it the UUID give by the
> toolstack is in place ahead of this.

Nit: The latter sentence is a little bumpy to read.

> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>
Re: [PATCH] xen/domain: Initialise the domain handle before inserting into the domlist
Posted by Andrew Cooper 11 months ago
On 10/03/2025 8:23 am, Jan Beulich wrote:
> On 07.03.2025 17:46, Andrew Cooper wrote:
>> As soon as the the domain is in the domlist, it can be queried via various
>> means, ahead of being fully constructed.  Ensure it the UUID give by the
>> toolstack is in place ahead of this.
> Nit: The latter sentence is a little bumpy to read.

Oh, yes.  Fixed.

>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>

Thanks.

~Andrew