KVM: arm64: vgic-v2: Check cpu interface region is not above the VM IPA size
authorRicardo Koller <ricarkol@google.com>
Tue, 5 Oct 2021 01:19:13 +0000 (18:19 -0700)
committerMarc Zyngier <maz@kernel.org>
Mon, 11 Oct 2021 08:31:41 +0000 (09:31 +0100)
commitc56a87da0a7fa14180082249ac954c7ebc9e74e1
tree0b6e5df5e586ffea6ecc041a3e9b00fd628ac686
parent4612d98f58c73ad63928200fd332f75c8e524dae
KVM: arm64: vgic-v2: Check cpu interface region is not above the VM IPA size

Verify that the GICv2 CPU interface does not extend beyond the
VM-specified IPA range (phys_size).

  base + size > phys_size AND base < phys_size

Add the missing check into kvm_vgic_addr() which is called when setting
the region. This patch also enables some superfluous checks for the
distributor (vgic_check_ioaddr was enough as alignment == size for the
distributors).

Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Ricardo Koller <ricarkol@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20211005011921.437353-4-ricarkol@google.com
arch/arm64/kvm/vgic/vgic-kvm-device.c