Skip to content

Commit fd6324d

Browse files
committed
irqchip/gic-v4: Correctly deal with set_affinity on lazily-mapped VPEs
jira LE-2177 cve CVE-2024-50192 Rebuild_History Non-Buildable kernel-5.14.0-503.19.1.el9_5 commit-author Marc Zyngier <maz@kernel.org> commit e6c24e2 Zenghui points out that a recent change to the way set_affinity is handled for VPEs has the potential to return an error if the VPE hasn't been mapped yet (because the guest hasn't emited a MAPTI command yet), affecting GICv4.0 implementations that rely on the ITSList feature. Fix this by making the set_affinity succeed in this case, and return early, without trying to touch the HW. Fixes: 1442ee0 ("irqchip/gic-v4: Don't allow a VMOVP on a dying VPE") Reported-by: Zenghui Yu <yuzenghui@huawei.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Zenghui Yu <yuzenghui@huawei.com> Link: https://lore.kernel.org/all/20241027102220.1858558-1-maz@kernel.org Link: https://lore.kernel.org/r/aab45cd3-e5ca-58cf-e081-e32a17f5b4e7@huawei.com (cherry picked from commit e6c24e2) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 8072908 commit fd6324d

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

drivers/irqchip/irq-gic-v3-its.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3824,8 +3824,18 @@ static int its_vpe_set_affinity(struct irq_data *d,
38243824
* Check if we're racing against a VPE being destroyed, for
38253825
* which we don't want to allow a VMOVP.
38263826
*/
3827-
if (!atomic_read(&vpe->vmapp_count))
3828-
return -EINVAL;
3827+
if (!atomic_read(&vpe->vmapp_count)) {
3828+
if (gic_requires_eager_mapping())
3829+
return -EINVAL;
3830+
3831+
/*
3832+
* If we lazily map the VPEs, this isn't an error and
3833+
* we can exit cleanly.
3834+
*/
3835+
cpu = cpumask_first(mask_val);
3836+
irq_data_update_effective_affinity(d, cpumask_of(cpu));
3837+
return IRQ_SET_MASK_OK_DONE;
3838+
}
38293839

38303840
/*
38313841
* Changing affinity is mega expensive, so let's be as lazy as

0 commit comments

Comments
 (0)