2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2025-01-04 11:43:54 +08:00
linux-next/arch/arm64/kvm/vgic
Ricardo Koller 4612d98f58 KVM: arm64: vgic-v3: Check redist region is not above the VM IPA size
Verify that the redistributor regions do not extend beyond the
VM-specified IPA range (phys_size). This can happen when using
KVM_VGIC_V3_ADDR_TYPE_REDIST or KVM_VGIC_V3_ADDR_TYPE_REDIST_REGIONS
with:

  base + size > phys_size AND base < phys_size

Add the missing check into vgic_v3_alloc_redist_region() which is called
when setting the regions, and into vgic_v3_check_base() which is called
when attempting the first vcpu-run. The vcpu-run check does not apply to
KVM_VGIC_V3_ADDR_TYPE_REDIST_REGIONS because the regions size is known
before the first vcpu-run. Note that using the REDIST_REGIONS API
results in a different check, which already exists, at first vcpu run:
that the number of redist regions is enough for all vcpus.

Finally, this patch also enables some extra tests in
vgic_v3_alloc_redist_region() by calculating "size" early for the legacy
redist api: like checking that the REDIST region can fit all the already
created vcpus.

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-3-ricarkol@google.com
2021-10-11 09:31:41 +01:00
..
trace.h
vgic-debug.c KVM: arm64: vgic-debug: Convert to use DEFINE_SEQ_ATTRIBUTE macro 2020-09-18 16:17:27 +01:00
vgic-init.c KVM: arm64: vgic: Let an interrupt controller advertise lack of HW deactivation 2021-06-01 10:45:59 +01:00
vgic-irqfd.c KVM: arm64: Allow in-atomic injection of SPIs 2020-07-05 17:26:15 +01:00
vgic-its.c ARM: 2021-05-01 10:14:08 -07:00
vgic-kvm-device.c kvm: arm64: vgic: Introduce vgic_check_iorange 2021-10-11 09:31:41 +01:00
vgic-mmio-v2.c KVM: arm64: Fix comments related to GICv2 PMR reporting 2021-08-02 14:49:39 +01:00
vgic-mmio-v3.c KVM: arm64: vgic-v3: Check redist region is not above the VM IPA size 2021-10-11 09:31:41 +01:00
vgic-mmio.c KVM: arm64: Simplify argument passing to vgic_uaccess_[read|write] 2021-04-06 14:51:38 +01:00
vgic-mmio.h
vgic-v2.c KVM: arm64: vgic: Resample HW pending state on deactivation 2021-08-20 08:53:22 +01:00
vgic-v3.c KVM: arm64: vgic-v3: Check redist region is not above the VM IPA size 2021-10-11 09:31:41 +01:00
vgic-v4.c KVM: arm64: GICv4.1: Restore VLPI pending state to physical side 2021-03-24 18:12:21 +00:00
vgic.c KVM: arm64: vgic: Resample HW pending state on deactivation 2021-08-20 08:53:22 +01:00
vgic.h kvm: arm64: vgic: Introduce vgic_check_iorange 2021-10-11 09:31:41 +01:00