All of lore.kernel.org
 help / color / mirror / Atom feed
* [for-4.22][PATCH] xen/arm: Fail domain construction if a secondary vCPU cannot be created
@ 2026-07-08  7:49 Michal Orzel
  2026-07-08  9:06 ` Halder, Ayan Kumar
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Michal Orzel @ 2026-07-08  7:49 UTC (permalink / raw)
  To: xen-devel
  Cc: Michal Orzel, Stefano Stabellini, Julien Grall, Bertrand Marquis,
	Volodymyr Babchuk, ayan.kumar.halder

construct_domain() creates the secondary vCPUs in a loop, but on a
vcpu_create() failure it only prints a message and breaks out of the
loop returning success. As a result the domain can be constructed
with fewer vCPUs than d->max_vcpus, leaving NULL holes in d->vcpu[]
below max_vcpus.

When the guest probes the redistributor of a vCPU that was never created,
get_vcpu_from_rdist() only checks vcpu_id against d->max_vcpus and then
dereferences the NULL d->vcpu[vcpu_id], resulting in a data abort.

Return an error instead of breaking out of the loop. Both callers
(construct_domU() and construct_hwdom()) already propagate a negative
return value and fail domain construction, which is the correct
behaviour: a domain that cannot provide the requested number of vCPUs
should not be brought up.

Fixes: 6b0e8e43348a ("xen/arm: allocate secondaries dom0 vcpus")
Signed-off-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/domain_build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 550617f152bb..b46574fd32aa 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1847,7 +1847,7 @@ int __init construct_domain(struct domain *d, struct kernel_info *kinfo)
         if ( vcpu_create(d, i) == NULL )
         {
             printk("Failed to allocate d%dv%d\n", d->domain_id, i);
-            break;
+            return -EINVAL;
         }
 
         if ( is_64bit_domain(d) )
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-07-08 11:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-08  7:49 [for-4.22][PATCH] xen/arm: Fail domain construction if a secondary vCPU cannot be created Michal Orzel
2026-07-08  9:06 ` Halder, Ayan Kumar
2026-07-08 11:20   ` Orzel, Michal
2026-07-08 11:27     ` Halder, Ayan Kumar
2026-07-08 11:31       ` Orzel, Michal
2026-07-08  9:18 ` Dmytro Prokopchuk1
2026-07-08 11:56   ` Orzel, Michal
2026-07-08 11:30 ` Andrew Cooper
2026-07-08 11:40   ` Orzel, Michal

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.