]> git.ipfire.org Git - thirdparty/linux.git/commit
KVM: riscv: Fix Spectre-v1 in APLIC interrupt handling
authorLukas Gerlach <lukas.gerlach@cispa.de>
Fri, 16 Jan 2026 09:57:31 +0000 (10:57 +0100)
committerAnup Patel <anup@brainfault.org>
Fri, 6 Mar 2026 05:50:30 +0000 (11:20 +0530)
commit8565617a8599dd17b96b7bf7e1eb19809ac6ae5e
treee292746984e5c13925c3aee325875b9d28cc8187
parent11439c4635edd669ae435eec308f4ab8a0804808
KVM: riscv: Fix Spectre-v1 in APLIC interrupt handling

Guests can control IRQ indices via MMIO. Sanitize them with
array_index_nospec() to prevent speculative out-of-bounds access
to the aplic->irqs[] array.

Similar to arm64 commit 41b87599c743 ("KVM: arm/arm64: vgic: fix possible
spectre-v1 in vgic_get_irq()") and x86 commit 8c86405f606c ("KVM: x86:
Protect ioapic_read_indirect() from Spectre-v1/L1TF attacks").

Fixes: 74967aa208e2 ("RISC-V: KVM: Add in-kernel emulation of AIA APLIC")
Signed-off-by: Lukas Gerlach <lukas.gerlach@cispa.de>
Reviewed-by: Nutty Liu <nutty.liu@hotmail.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20260116095731.24555-1-lukas.gerlach@cispa.de
Signed-off-by: Anup Patel <anup@brainfault.org>
arch/riscv/kvm/aia_aplic.c