Skip to content

Commit 6705645

Browse files
marpombonzini
authored andcommitted
KVM: x86: Protect ioapic_write_indirect() from Spectre-v1/L1TF attacks
This fixes a Spectre-v1/L1TF vulnerability in ioapic_write_indirect(). This function contains index computations based on the (attacker-controlled) IOREGSEL register. This patch depends on patch "KVM: x86: Protect ioapic_read_indirect() from Spectre-v1/L1TF attacks". Fixes: 70f93da ("KVM: Use temporary variable to shorten lines.") Signed-off-by: Nick Finco <[email protected]> Signed-off-by: Marios Pomonis <[email protected]> Reviewed-by: Andrew Honig <[email protected]> Cc: [email protected] Reviewed-by: Jim Mattson <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 8c86405 commit 6705645

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

arch/x86/kvm/ioapic.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val)
297297

298298
if (index >= IOAPIC_NUM_PINS)
299299
return;
300+
index = array_index_nospec(index, IOAPIC_NUM_PINS);
300301
e = &ioapic->redirtbl[index];
301302
mask_before = e->fields.mask;
302303
/* Preserve read-only fields */

0 commit comments

Comments
 (0)