target/arm: Be more defensive for invalid tlbi_aa64_get_range
PATCH 1/1 target/arm: Be more defensive for invalid tlbi_aa64_get_range
It's possible to program TCR_ELx with an invalid granule size, which could match passing an invalid granule size to TLBI RVA, which would then fall through to assert in arm_granule_bits.
Fixes 3c003f7029e ("target/arm: Use ARMGranuleSize in ARMVAParameters")
Signed-off-by Richard Henderson <[email protected]>
--- target/arm/tcg/tlb-insns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/arm/tcg/tlb-insns.c +1 -1
@@ -854,7 +854,7 @@ static TLBIRange tlbi_aa64_get_range(CPUARMState *env, ARMMMUIdx mmuidx, gran =tlbi_range_tg_to_gran_size (page_size_granule);/* The granule encoded in value must match the granule in use. */ -if (gran != param.gran) { +if (gran != param.gran || gran == GranInvalid) {qemu_log_mask (LOG_GUEST_ERROR ,"Invalid tlbi page size granule %d\n" , page_size_granule);return ret;
Signature · 1 line
2.43.0
Quoted 10 lines · Richard Henderson
It's possible to program
TCR_ELxwith an invalid granule size, which could match passing an invalid granule size to TLBI RVA, which would then fall through to assert inarm_granule_bits.Fixes 3c003f7029e ("target/arm: Use ARMGranuleSize in ARMVAParameters")Signed-off-by Richard Henderson <[email protected]>--- target/arm/tcg/tlb-insns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Ah, out of the breakpoint/watchpoint rework, good.
Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Peter Maydell
AppliedQuoted 9 lines · Richard Henderson
It's possible to program
TCR_ELxwith an invalid granule size, which could match passing an invalid granule size to TLBI RVA, which would then fall through to assert inarm_granule_bits.Fixes 3c003f7029e ("target/arm: Use ARMGranuleSize in ARMVAParameters")Signed-off-by Richard Henderson <[email protected]>---
Applied to target-arm.next, thanks.
-- PMM