|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] xen/arm: guest_walk: refuse an address outside both halves of the range
commit a407c9eb56675e165acdc49d14dba0dbe3be826f
Author: Stefano Stabellini <stefano.stabellini@xxxxxxx>
AuthorDate: Wed Nov 18 01:59:01 2026 +0100
Commit: Michal Orzel <michal.orzel@xxxxxxx>
CommitDate: Thu Nov 19 08:18:28 2026 +0100
xen/arm: guest_walk: refuse an address outside both halves of the range
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>
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
---
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 09fe486598..7da3df886a 100644
--- a/xen/arch/arm/guest_walk.c
+++ b/xen/arch/arm/guest_walk.c
@@ -407,6 +407,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
{
--
generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |