|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 2/4] xen/arm: guest_walk: refuse an address outside both halves of the range
Hi,
Stefano Stabellini <stefano.stabellini@xxxxxxx> writes:
> The bits of an input address from its top bit (bit 63, or bit 55 with
> the top byte ignored) down to the input address size must be all 0 for
> TTBR0 and all 1 for TTBR1, else the walk faults (ARM DDI 0487 M.d
> D8.2.4, AArch64.VAIsOutOfRange()). guest_walk_ld() chose the base from
> the top bit alone and translated such an address. Refuse it before
> reading any table.
>
> 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 (D8.2.4, AArch64.VAIsOutOfRange()) instead of
> A.k, in the commit message and the comment.
> - Move the Cc list after ---.
> ---
> xen/arch/arm/guest_walk.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/xen/arch/arm/guest_walk.c b/xen/arch/arm/guest_walk.c
> index 151b837541..8c73ceb04d 100644
> --- a/xen/arch/arm/guest_walk.c
> +++ b/xen/arch/arm/guest_walk.c
> @@ -408,6 +408,15 @@ static bool guest_walk_ld(const struct vcpu *v,
> if ( (input_size > TCR_EL1_IPS_48_BIT_VAL) ||
> (input_size < TCR_EL1_IPS_MIN_VAL) )
> return false;
> +
> + /*
> + * The bits of the GVA from the top bit down to the input size must
> + * all be 0 for TTBR0 and all 1 for TTBR1, or the translation faults
> + * (ARM DDI 0487 M.d D8.2.4, AArch64.VAIsOutOfRange()).
> + */
> + mask = GENMASK_ULL(topbit, input_size);
> + if ( (gva & mask) != ((gva & BIT(topbit, ULL)) ? mask : 0) )
> + return false;
> }
> else
> {
--
WBR, Volodymyr
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |