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

Re: [PATCH v2 1/4] xen/arm: guest_walk: refuse a block descriptor where the granule has none


  • To: Stefano Stabellini <stefano.stabellini@xxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Wed, 18 Nov 2026 02:04:56 +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=BHcjllk6KTl6GJgoRWYZw9oDjzvNxyt2oYgVCpo1e/w=; b=p432CJBTAtfYS1e02WFgyIEs4l/j8oZnK1pEagQu3D1y+izjHkoZpgFnZ/BpIaZ+gmHa/+dDrHlYfjWEOAUbO5RmGUYuDe2Pbc/OtEhS+D1XgXH6gr/ooU4saE6HZ7vRC+XbNIB0OZt+VGFHKTrMfz5aTZiIY4rs3XfQZ/sm+VMVBkRuQnIw5MqV63Deu0oZ79c7EOAs/VrY/xLZOu4i4EYKHF5V46FzehMegOHnmZg8/H1K7z7UYBWv7Jb3rmJMKTrMcC/vzT6G8czA33QVMRANSMFIYaWPiUJeVyJu/yLllqp5A87+oe4DCFLOhhAg4CoXnyu5MVsxSHPBp+cMrg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=R2J92/mUE/bSIKo/XWjp1K6NfFM0k+naC5wjTlmPu7UiO1xAgNd8AlUFpsmHmde4Q1qF5JhGyaw5tSZZgrm+cfeuLyW4Mjdnf4bqM6nlDM0kCfMtba7+TRiA/3qftvWS2sk8PlZlZLDA2MLynNsncMW1ZU8gN5A5QpqxjEGnMudq887kDYoUJx4OimRHc2nxQu/hQUzsVGOttoDQ0QVDSI2gnv+jIcuZYP6fLBuLJPhgcgoIXlmlN2RgWdN7kinpS8LjbSt3OhnGJkxKl587NO91d5FIvJ0SKqDkgVtD0azSJ+eofEuw527u+H6vL7KPuQdpfVbbIyMgCF0+Ah3iiQ==
  • 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: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>
  • Delivery-date: Wed, 18 Nov 2026 02:05:11 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHddvgMeyG0orwvkUSe3KGMpYyQdbczFHiA
  • Thread-topic: [PATCH v2 1/4] xen/arm: guest_walk: refuse a block descriptor where the granule has none

Hello Stefano,

Stefano Stabellini <stefano.stabellini@xxxxxxx> writes:

> guest_walk_ld() accepted a block descriptor at any level. No granule has
> level 0 blocks, and the 16KB and 64KB granules have no level 1 blocks
> (ARM DDI 0487 M.d D8.3.1.2): the translation table walk makes such an
> entry a Translation fault (AArch64.BlockDescSupported()). Refuse it.
>
> The check is only valid without 52-bit support (FEAT_LPA, FEAT_LPA2).
> Note in get_ipa_output_size() that 52-bit support requires updating it.
>
> Fixes: 7d623b358a45 ("arm/mem_access: Add long-descriptor based gpt")
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx>

Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>

> ---
> Cc: Julien Grall <julien@xxxxxxx>
> Cc: Bertrand Marquis <bertrand.marquis@xxxxxxx>
> Cc: Michal Orzel <michal.orzel@xxxxxxx>
> Cc: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
>
> Changes in v2:
> - Cite ARM DDI 0487 M.d instead of A.k.
> - Say in the commit message and the comment that the check is only
>   valid without 52-bit support (FEAT_LPA, FEAT_LPA2), and note in
>   get_ipa_output_size() that 52-bit support requires updating it.
> - Move the Cc list after ---.
> ---
>  xen/arch/arm/guest_walk.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/xen/arch/arm/guest_walk.c b/xen/arch/arm/guest_walk.c
> index 09fe486598..151b837541 100644
> --- a/xen/arch/arm/guest_walk.c
> +++ b/xen/arch/arm/guest_walk.c
> @@ -201,7 +201,8 @@ static int get_ipa_output_size(struct domain *d, 
> register_t tcr,
>           * Return an error on reserved IPA output-sizes and if the IPA
>           * output-size is 52bit.
>           *
> -         * XXX: 52 bit output-size is not supported yet.
> +         * XXX: 52 bit output-size is not supported yet. Supporting it also
> +         * requires updating the block descriptor check in guest_walk_ld().
>           */
>          if ( ips > TCR_EL1_IPS_48_BIT )
>              return -EFAULT;
> @@ -533,6 +534,17 @@ static bool guest_walk_ld(const struct vcpu *v,
>      if ( !lpae_is_valid(pte) || !lpae_is_mapping(pte, level) )
>          return false;
>  
> +    /*
> +     * A block descriptor is only supported at level 1 and level 2 with the
> +     * 4KB granule, and only at level 2 with the 16KB and 64KB granules (ARM
> +     * DDI 0487 M.d D8.3.1.2). The block encoding at any other level 
> generates
> +     * a Translation fault (AArch64.BlockDescSupported()).
> +     *
> +     * This is only valid without 52-bit support (FEAT_LPA, FEAT_LPA2).
> +     */
> +    if ( level == 0 || (level == 1 && gran != GRANULE_SIZE_INDEX_4K) )
> +        return false;
> +
>      /* Make sure that the lower bits of the PTE's base address are zero. */
>      mask = GENMASK_ULL(47, grainsizes[gran]);
>      *ipa = (pfn_to_paddr(pte.walk.base) & mask) |

-- 
WBR, Volodymyr


 


Rackspace

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