[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [XEN][PATCH 1/7] xen/arm64: domctl: set_address_size add check for vcpus not initialized
- To: Grygorii Strashko <grygorii_strashko@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
- Date: Thu, 31 Jul 2025 15:09:50 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=epam.com 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=huCkNkaOGHuxWvWhRWqh6OENZYV8i/dmfsSgn7V2cJ4=; b=akMP48YaWWUsskL/DqAdbsbsmt739cx5HQeVOg3duAuEMOxHvqHjctO6inGUifyQu60T7fNdvyNCAsfZ+y2mXB60A5zav2ij1NZYcVo82gYO/PnZMqtpb8RFdiMC9c1kIShWJ2OdGz6cQu1IeXFR+BCSBFtCPTnWgA9YfrcbRLmP/tALZ3KSqY+SyfLHlF1bx2EcOIVQEL9zc24SuSF6jtr3Arop77RolrDe7qRfLF4wEB9YQB6ju958UoxDpsboY4Uxp1q1NhS1k+YFJKF9oHYLxirKrhyi4+5Pa17p7xKn+/02D2+C8lp15beARnHRf77H1PI8TKtOhBuRGyToPA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iDqIJ1ABOp3g6oeBIYyhmTW+xB+4L2jlFVLbTnPOkruJFBulJRUQJUSmxbHS0vqzPKmxNjTiHp2l7dWzkr2p03m3vttPbwgzmrcBS4V+DSybkMoUw16WM8MrrF1ABroj7kAtl7j2GUX49ZlFewMxgOnGgNuviXUU8lpVcvesp5sOQ95kj8M6Fk07PB5VVFfqrxpshay6UxgTOqQmSsyLbdCMkYCtg3VX6AjOtcifpIc+ja8WQXJYm+zjiLo2lzU04HCjn9olSS9hbkrRw1jXN0tbC7/OwR60bFLSsBFzb7/dqIs9diU+4X+KAn4kiebXWgoRxi1liVWvw4um589vjg==
- Cc: 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 13:10:09 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Thu Jul 31, 2025 at 11:42 AM CEST, Grygorii Strashko wrote:
> From: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
>
> The vcpu ctx initialization (arch_set_info_guest()) is depends on proper
^
stray "is"
> 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)
nit: I'd call it vcpus_any_initialised(), that way it's far easier to
see what it does without jumping into the implementation.
> +{
> + 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;
>
|