diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2022-01-22 18:24:42 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2022-01-28 14:29:47 +0000 |
commit | 8b8bb0146b5383188e045ab75a53a0e179614cad (patch) | |
tree | 7b0ae074dc2ee0895d4071af2400c008d2740f98 /include/hw/intc | |
parent | 0ffe88e6919d210c806078aaf0c34911554f1438 (diff) | |
download | qemu-8b8bb0146b5383188e045ab75a53a0e179614cad.zip qemu-8b8bb0146b5383188e045ab75a53a0e179614cad.tar.gz qemu-8b8bb0146b5383188e045ab75a53a0e179614cad.tar.bz2 |
hw/intc/arm_gicv3_its: Check table bounds against correct limit
Currently when we fill in a TableDesc based on the value the guest
has written to the GITS_BASER<n> register, we calculate both:
* num_entries : the number of entries in the table, constrained
by the amount of memory the guest has given it
* num_ids : the number of IDs we support for this table,
constrained by the implementation choices and the architecture
(eg DeviceIDs are 16 bits, so num_ids is 1 << 16)
When validating ITS commands, however, we check only num_ids,
thus allowing a broken guest to specify table entries that
index off the end of it. This will only corrupt guest memory,
but the ITS is supposed to reject such commands as invalid.
Instead of calculating both num_entries and num_ids, set
num_entries to the minimum of the two limits, and check that.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220122182444.724087-13-peter.maydell@linaro.org
Diffstat (limited to 'include/hw/intc')
-rw-r--r-- | include/hw/intc/arm_gicv3_its_common.h | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/include/hw/intc/arm_gicv3_its_common.h b/include/hw/intc/arm_gicv3_its_common.h index b32c697..3e2ad2d 100644 --- a/include/hw/intc/arm_gicv3_its_common.h +++ b/include/hw/intc/arm_gicv3_its_common.h @@ -47,7 +47,6 @@ typedef struct { uint16_t entry_sz; uint32_t page_sz; uint32_t num_entries; - uint32_t num_ids; uint64_t base_addr; } TableDesc; |