Skip to content

Commit 3a5f59a

Browse files
pvts-matPlaidCat
authored andcommitted
KVM: arm64: vgic-its: Avoid potential UAF in LPI translation cache
jira VULN-8190 cve CVE-2024-26598 commit-author Oliver Upton <[email protected]> commit ad362fe There is a potential UAF scenario in the case of an LPI translation cache hit racing with an operation that invalidates the cache, such as a DISCARD ITS command. The root of the problem is that vgic_its_check_cache() does not elevate the refcount on the vgic_irq before dropping the lock that serializes refcount changes. Have vgic_its_check_cache() raise the refcount on the returned vgic_irq and add the corresponding decrement after queueing the interrupt. Cc: [email protected] Signed-off-by: Oliver Upton <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] (cherry picked from commit ad362fe) Signed-off-by: Marcin Wcisło <[email protected]>
1 parent 04479cb commit 3a5f59a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

arch/arm64/kvm/vgic/vgic-its.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,11 @@ static struct vgic_irq *vgic_its_check_cache(struct kvm *kvm, phys_addr_t db,
584584
unsigned long flags;
585585

586586
raw_spin_lock_irqsave(&dist->lpi_list_lock, flags);
587+
587588
irq = __vgic_its_check_cache(dist, db, devid, eventid);
589+
if (irq)
590+
vgic_get_irq_kref(irq);
591+
588592
raw_spin_unlock_irqrestore(&dist->lpi_list_lock, flags);
589593

590594
return irq;
@@ -763,6 +767,7 @@ int vgic_its_inject_cached_translation(struct kvm *kvm, struct kvm_msi *msi)
763767
raw_spin_lock_irqsave(&irq->irq_lock, flags);
764768
irq->pending_latch = true;
765769
vgic_queue_irq_unlock(kvm, irq, flags);
770+
vgic_put_irq(kvm, irq);
766771

767772
return 0;
768773
}

0 commit comments

Comments
 (0)