[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[for-4.22][PATCH] xen/arm: Fail domain construction if a secondary vCPU cannot be created
- To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Michal Orzel <michal.orzel@xxxxxxx>
- Date: Wed, 8 Jul 2026 09:49:19 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OR6VlZfptXUjOwDr2aFzCqN6jh9+wY6MDQv0CCeuibY=; b=cNoxb2l9SsQN5VcAmtm2Os+jZ3SEe2Pex3WjlWoP2+ZozUjMfDvU2+jiashPtJ0OnayPhhPmunYwL+AoYQLAc5n6b2beypuNb7WAJTNBeDnFmvHtPp0QXkF7INfzFj4GiHzSHLDy199nK718ivRGUUpJUdb1awcpa7eql9h1allfrpf8ft/PecsxR1/NTU6AAgV7uFc5O9B6n+22f0gGfW68aWWFRlKoHL1wkoqT181q2gH2XCg4j65R6DLo3MYz2MlfCgj/Z/MrtcEnRL7kbCeTBvmw20+dcbxZfpLcn9iRA/r4FgE2xJvW5vI0+Z3qmVo9C7KF9tvGbiXvDvuMgA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FDUviwYPwm7RxDd7vImGo3R1njAN3cppE7nof++P95nCmLF34AriEbNS8sINqeC188scrwKrKaA6FcUqk+Hi7+TA7R19otPM7L3Vg5dym9GfIz4OA0diIhSIfMexSeUOTmkQ/UXMpKSgPi27bJC5LEM59CJe5ZcYKv4hK7oWR1YsARwx/Vkb0jkrSjAkD4iwV5HT9G2E1hSyhTlEJdfJKLysylmN62QGmVVsBxWAq5B2y/WHY/7Ff/Omt1Vbg62z70DPF6Po1B72q/POhvZeWXcSGJTQ+Adde+D8Jpwq8c4e2VFvoH7bZz6iNFiVMgQiwCjssLWN3q/ypSZ2sizV1g==
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
- Cc: Michal Orzel <michal.orzel@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, <ayan.kumar.halder@xxxxxxx>
- Delivery-date: Wed, 08 Jul 2026 07:49:56 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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@xxxxxxx>
---
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
|