Skip to content

Commit d561491

Browse files
Marc Zyngieroupton
authored andcommitted
KVM: arm64: vgic-v3: Sanitise guest writes to GICR_INVLPIR
Make sure we filter out non-LPI invalidation when handling writes to GICR_INVLPIR. Fixes: 4645d11 ("KVM: arm64: vgic-v3: Implement MMIO-based LPI invalidation") Reported-by: Alexander Potapenko <glider@google.com> Tested-by: Alexander Potapenko <glider@google.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20241117165757.247686-2-maz@kernel.org Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
1 parent 60ad25e commit d561491

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

arch/arm64/kvm/vgic/vgic-mmio-v3.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ static void vgic_mmio_write_invlpi(struct kvm_vcpu *vcpu,
530530
unsigned long val)
531531
{
532532
struct vgic_irq *irq;
533+
u32 intid;
533534

534535
/*
535536
* If the guest wrote only to the upper 32bit part of the
@@ -541,9 +542,13 @@ static void vgic_mmio_write_invlpi(struct kvm_vcpu *vcpu,
541542
if ((addr & 4) || !vgic_lpis_enabled(vcpu))
542543
return;
543544

545+
intid = lower_32_bits(val);
546+
if (intid < VGIC_MIN_LPI)
547+
return;
548+
544549
vgic_set_rdist_busy(vcpu, true);
545550

546-
irq = vgic_get_irq(vcpu->kvm, NULL, lower_32_bits(val));
551+
irq = vgic_get_irq(vcpu->kvm, NULL, intid);
547552
if (irq) {
548553
vgic_its_inv_lpi(vcpu->kvm, irq);
549554
vgic_put_irq(vcpu->kvm, irq);

0 commit comments

Comments
 (0)