Skip to content

Commit 1e749f1

Browse files
Marc ZyngierWen Zhiwei
authored andcommitted
KVM: arm64: vgic-v3: Sanitise guest writes to GICR_INVLPIR
stable inclusion from stable-v6.6.64 commit 26cd7f91f27f97fb64cf22ae80f96e4ff46cefb2 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IBL4B6 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=26cd7f91f27f97fb64cf22ae80f96e4ff46cefb2 -------------------------------- commit d561491ba927cb5634094ff311795e9d618e9b86 upstream. 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 <[email protected]> Tested-by: Alexander Potapenko <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Wen Zhiwei <[email protected]>
1 parent ef02af3 commit 1e749f1

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
@@ -580,6 +580,7 @@ static void vgic_mmio_write_invlpi(struct kvm_vcpu *vcpu,
580580
unsigned long val)
581581
{
582582
struct vgic_irq *irq;
583+
u32 intid;
583584

584585
/*
585586
* If the guest wrote only to the upper 32bit part of the
@@ -591,9 +592,13 @@ static void vgic_mmio_write_invlpi(struct kvm_vcpu *vcpu,
591592
if ((addr & 4) || !vgic_lpis_enabled(vcpu))
592593
return;
593594

595+
intid = lower_32_bits(val);
596+
if (intid < VGIC_MIN_LPI)
597+
return;
598+
594599
vgic_set_rdist_busy(vcpu, true);
595600

596-
irq = vgic_get_irq(vcpu->kvm, NULL, lower_32_bits(val));
601+
irq = vgic_get_irq(vcpu->kvm, NULL, intid);
597602
if (irq) {
598603
vgic_its_inv_lpi(vcpu->kvm, irq);
599604
vgic_put_irq(vcpu->kvm, irq);

0 commit comments

Comments
 (0)