OSDN Git Service

hw/intc/arm_gicv3_its: Correct off-by-one bounds check on rdbase
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 7 Jan 2022 17:07:57 +0000 (17:07 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 7 Jan 2022 17:07:57 +0000 (17:07 +0000)
commita120157b24c78c2d890cd9793eb5a1cbbf42c9a9
tree2151741769c24ef9b0412cb6d921db87debe0727
parentb7469ef92a8034b32031ba22b84fb14046f9770e
hw/intc/arm_gicv3_its: Correct off-by-one bounds check on rdbase

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