[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/19] hw/intc/arm_gicv3_its: Correct off-by-one bounds check on r
|
From: |
Peter Maydell |
|
Subject: |
[PULL 03/19] hw/intc/arm_gicv3_its: Correct off-by-one bounds check on rdbase |
|
Date: |
Fri, 7 Jan 2022 17:21:26 +0000 |
The checks in the ITS on the rdbase values in guest commands are
off-by-one: they permit the guest to pass us a value equal to
s->gicv3->num_cpu, but the valid values are 0...num_cpu-1. This
meant the guest could cause us to index off the end of the
s->gicv3->cpu[] array when calling gicv3_redist_process_lpi(), and we
would probably crash.
(This is not a security bug, because this code is only usable
with emulation, not with KVM.)
Cc: qemu-stable@nongnu.org
Fixes: 17fb5e36aabd4b ("hw/intc: GICv3 redistributor ITS processing")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
hw/intc/arm_gicv3_its.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c
index b99e63d58f7..677b96dfe23 100644
--- a/hw/intc/arm_gicv3_its.c
+++ b/hw/intc/arm_gicv3_its.c
@@ -311,7 +311,7 @@ static bool process_its_cmd(GICv3ITSState *s, uint64_t
value, uint32_t offset,
*/
rdbase = (cte & GITS_CTE_RDBASE_PROCNUM_MASK) >> 1U;
- if (rdbase > s->gicv3->num_cpu) {
+ if (rdbase >= s->gicv3->num_cpu) {
return result;
}
@@ -505,7 +505,7 @@ static bool process_mapc(GICv3ITSState *s, uint32_t offset)
valid = (value & CMD_FIELD_VALID_MASK);
- if ((icid > s->ct.maxids.max_collids) || (rdbase > s->gicv3->num_cpu)) {
+ if ((icid > s->ct.maxids.max_collids) || (rdbase >= s->gicv3->num_cpu)) {
qemu_log_mask(LOG_GUEST_ERROR,
"ITS MAPC: invalid collection table attributes "
"icid %d rdbase %" PRIu64 "\n", icid, rdbase);
--
2.25.1
- [PULL 00/19] target-arm queue, Peter Maydell, 2022/01/07
- [PULL 02/19] target/arm: Add missing FEAT_TLBIOS instructions, Peter Maydell, 2022/01/07
- [PULL 08/19] hw/intc/arm_gicv3_its: Correct setting of TableDesc entry_sz, Peter Maydell, 2022/01/07
- [PULL 11/19] hw/intc/arm_gicv3_its: Use FIELD macros for DTEs, Peter Maydell, 2022/01/07
- [PULL 05/19] hw/intc/arm_gicv3_its: Remove maxids union from TableDesc, Peter Maydell, 2022/01/07
- [PULL 01/19] Add dummy Aspeed AST2600 Display Port MCU (DPMCU), Peter Maydell, 2022/01/07
- [PULL 03/19] hw/intc/arm_gicv3_its: Correct off-by-one bounds check on rdbase,
Peter Maydell <=
- [PULL 04/19] hw/intc/arm_gicv3_its: Remove redundant ITS_CTLR_ENABLED define, Peter Maydell, 2022/01/07
- [PULL 06/19] hw/intc/arm_gicv3_its: Don't return early in extract_table_params() loop, Peter Maydell, 2022/01/07
- [PULL 07/19] hw/intc/arm_gicv3_its: Reduce code duplication in extract_table_params(), Peter Maydell, 2022/01/07
- [PULL 14/19] hw/intc/arm_gicv3_its: Fix various off-by-one errors, Peter Maydell, 2022/01/07
- [PULL 18/19] hw/arm: add i2c muxes to kudo-bmc, Peter Maydell, 2022/01/07
- [PULL 16/19] hw/arm: Add kudo i2c eeproms., Peter Maydell, 2022/01/07
- [PULL 17/19] hw/arm: attach MMC to kudo-bmc, Peter Maydell, 2022/01/07
- [PULL 12/19] hw/intc/arm_gicv3_its: Correct comment about CTE RDBase field size, Peter Maydell, 2022/01/07
- [PULL 10/19] hw/intc/arm_gicv3_its: Correct handling of MAPI, Peter Maydell, 2022/01/07
- [PULL 13/19] hw/intc/arm_gicv3_its: Use FIELD macros for CTEs, Peter Maydell, 2022/01/07