Skip to contentSkip to conversation

xen/domain: Initialise the domain handle before inserting into the domlist

PATCH In review Andrew Cooper 2 participants 3 messages Mar 7, 2025 – Mar 10, 2025

lore
Share & tools
lore
#0 lore raw

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

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.

---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>

Quite possibly benign right now, but the change is appropriate nonetheless.

---
 xen/common/domain.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
xen/common/domain.c +2 -1
index b887c60ecc1d..8d0125bb8fd0 100644
@@ -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;
 
Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Andrew Cooper

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.

Quoted 1 line
#2 lore raw
Quoted 5 lines · Jan Beulich
Quoted 3 lines · Andrew Cooper

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.

Quoted 3 lines
Quoted 2 lines

Thanks.

~Andrew