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

[XEN][PATCH 1/7] xen/arm64: domctl: set_address_size add check for vcpus not initialized


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
  • Date: Thu, 31 Jul 2025 09:42:37 +0000
  • Accept-language: en-US
  • 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=fioyZWFcXMIEFPbcuYZDTxSLNStujdo6wFiNN5v4AGo=; b=edpOhnt+fXZ0vToi2dlUqoy7K81TNHpcIgQD15NIx9aB3fyp1faQeQdQefRvlsVoZUUMxh1i24jstPoxI3UjXC7TUDNieNvwASGw8SROP5opULiIifG7xpEZiv+AoFR4ea2oiWft2n3wEwTRZBQnx0iTl1xCkIrp9yhc/Hq/pcSV8RJA49viQj/vTupA4Ul/1lXSB+WLn8JGGLRe6BLnXhmCDL9E32M3H/bC/ikyHh6pUWWsNECLApOfLgOFSsocyobjrw66UjisSsWmZB9hodkYwI9Z/lfQX+T4NrxxAfTIZPKRqDlIrLf1C9YwyMAFCeUEDyTnbYayYQ6xx0R6Xw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MpCXId7WFtYd48esdnLl/gsBZY4f4m78VyB6fjSafmSDjdqxkqAGRsbR5HXNBHGXg07lo1D2t3xBSPaAOf2YDLX7gja2s4ApG91nMKY7EoUn7myalYn/4wd47iWGoPTO4y13B3aDRAkoa0JTuJJiwRT2cYrXC3NPtNfIy3hchf6HThVG2ozg353gis73qrePrA4sRlhw1R5QjDeMCHYQ5DVtYlxqmct356hyyCDs+CUqGuKm3DsFk1azowEc4pqhTRFKe0/bjOLMPOV3IaFMjqA6AzvebYIExoLfg3FD/hQVnHZF/RVJUdL4Lph9pf7j2H+KcDbvGjWozi50MPaGfw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>, Grygorii Strashko <grygorii_strashko@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 31 Jul 2025 09:42:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHcAf9z+cgJcZklCkuBKcN3O427bQ==
  • Thread-topic: [XEN][PATCH 1/7] xen/arm64: domctl: set_address_size add check for vcpus not initialized

From: Grygorii Strashko <grygorii_strashko@xxxxxxxx>

The vcpu ctx initialization (arch_set_info_guest()) is depends on proper
domain type (32/64bit) configuration, so check that vcpus are not
initialized when toolstack issues XEN_DOMCTL_set_address_size hypercall.

Signed-off-by: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
---
 xen/arch/arm/arm64/domctl.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/xen/arch/arm/arm64/domctl.c b/xen/arch/arm/arm64/domctl.c
index 8720d126c97d..82eff26fb0d1 100644
--- a/xen/arch/arm/arm64/domctl.c
+++ b/xen/arch/arm/arm64/domctl.c
@@ -13,6 +13,19 @@
 #include <asm/arm64/sve.h>
 #include <asm/cpufeature.h>
 
+static bool vcpus_check_initialised(struct domain *d)
+{
+    struct vcpu *v;
+
+    for_each_vcpu(d, v)
+    {
+        if ( v->is_initialised )
+            return true;
+    }
+
+    return false;
+}
+
 static long switch_mode(struct domain *d, enum domain_type type)
 {
     struct vcpu *v;
@@ -21,6 +34,8 @@ static long switch_mode(struct domain *d, enum domain_type 
type)
         return -EINVAL;
     if ( domain_tot_pages(d) != 0 )
         return -EBUSY;
+    if ( vcpus_check_initialised(d) )
+        return -EBUSY;
     if ( d->arch.type == type )
         return 0;
 
-- 
2.34.1



 


Rackspace

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