History

KVM: Fix bounds checking in ioapic indirect register reads (CVE-2013-1798)

If the guest specifies a IOAPIC_REG_SELECT with an invalid value and follows that with a read of the IOAPIC_REG_WINDOW KVM does not properly validate that request. ioapic_read_indirect contains an ASSERT(redir_index < IOAPIC_NUM_PINS), but the ASSERT has no effect in non-debug builds. In recent kernels this allows a guest to cause a kernel oops by reading invalid memory. In older kernels (pre-3.3) this allows a guest to read from large ranges of host memory. Tested: tested against apic unit tests.

Andy Honig committed 13 years ago

Commit a2c118b1 parent 0b794591 file · +5 −2Browse files

Unified · Split

virt/kvm/ioapic.c+5−2
@@ -74,9 +74,12 @@ static unsigned long ioapic_read_indirect(struct kvm_ioapic *ioapic, · 73 unmodified lines
7474 u32 redir_index = (ioapic->ioregsel - 0x10) >> 1;
7575 u64 redir_content;
7676
77− ASSERT(redir_index < IOAPIC_NUM_PINS);
77+ if (redir_index < IOAPIC_NUM_PINS)
78+ redir_content =
79+ ioapic->redirtbl[redir_index].bits;
80+ else
81+ redir_content = ~0ULL;
7882
79− redir_content = ioapic->redirtbl[redir_index].bits;
8083 result = (ioapic->ioregsel & 0x1) ?
8184 (redir_content >> 32) & 0xffffffff :
8285 redir_content & 0xffffffff;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t