[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [for-4.22][PATCH] xen/arm: Fail domain construction if a secondary vCPU cannot be created


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
  • Date: Wed, 8 Jul 2026 09:18:23 +0000
  • Accept-language: en-US, uk-UA, ru-RU
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • 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=5VUNT/jhTjskRtdJlHO4bSUe2g74vka9Yns7f8BraCY=; b=ZVngrr3K0Vi4vcQYA8bZaHovhkQCh72LE1WM3zh4jll/zU6WoudxFYdd1MwOjPyyn2cYCk1KbW4qqVPryV18FrttLpVfqgFkKWj6dD/Y04Sr7DJV2FWS9wMgOfabId7W8fJWear3I6WOBSB4FIfXHUJMknVyal1ET7PdiIwWctrM6rUbYhiRLOIGSPcndbfilBMy2Tw6juYo9v2nCR9Ma1x6Z5CLPJv0S+Kzclc0kMaRZJdx5HzaRxNCc27H8ZVAinn7eVGeb1+elHcYSl0JhVKhRm+RpqWgoqJGBZzQU3cdL/vEGUGRHxJM4yO8nb5XJs2lc+TNdBhKz2K+dU2oGQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Uy9QtJlTnMNwYdewjNUwHjKmWDIaOuN7JEwFmacAr8sPkMQTjS73JbTzX7/28X63nB2XnDpRjCBbNM5In/X1qPMKJtsfe6mx8KqigTo5sgbkh7vjGKWC0TxROBn1nFDR1XCgb2p7bdTCoysTAn/ZWRTz76/cq7faDmIQ3DayYCywQsU08x8pSD/FQYyEztsJ/x7t0SfJbLtAnmNUxlCdi8LsIeIR6PduWAWA5n/FbM1CxgKJUhcWuhqUW01IaVLCAnkrPa9vkhXDomyb7nfCNGVQhep89ceeH6SI92N8TdK5VTS4To1N80siPQkDyB1GjJ3TREWOSHO4KVLYOPt1wA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Delivery-date: Wed, 08 Jul 2026 09:18:35 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHdDq5gOqNqAqj/K0Gfl8kk0v3OprZjWBUA
  • Thread-topic: [for-4.22][PATCH] xen/arm: Fail domain construction if a secondary vCPU cannot be created

Hi Michal,

On 7/8/26 10:49, Michal Orzel wrote:
> 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;

I would say returning "-ENOMEM" is more actual here, because 
vcpu_create() fails in most cases due to unable to allocate memory.

>           }
>   
>           if ( is_64bit_domain(d) )

BR, Dmytro.

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.