aboutsummaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorAndy Honig <ahonig@google.com>2013-02-20 14:49:16 -0800
committerBen Hutchings <ben@decadent.org.uk>2013-04-25 20:25:50 +0100
commit6d29de40486edf7d5a61d40f4b18431e2c644ad0 (patch)
tree79b8bca014162a42c335fc082cc6294aec35247d /virt
parent767d3d43c0a02485a8574c0efe39524f246d698b (diff)
downloadkernel_samsung_smdk4412-6d29de40486edf7d5a61d40f4b18431e2c644ad0.zip
kernel_samsung_smdk4412-6d29de40486edf7d5a61d40f4b18431e2c644ad0.tar.gz
kernel_samsung_smdk4412-6d29de40486edf7d5a61d40f4b18431e2c644ad0.tar.bz2
KVM: Fix bounds checking in ioapic indirect register reads (CVE-2013-1798)
commit a2c118bfab8bc6b8bb213abfc35201e441693d55 upstream. 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. Signed-off-by: Andrew Honig <ahonig@google.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/ioapic.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c
index 3eed61e..79647cd 100644
--- a/virt/kvm/ioapic.c
+++ b/virt/kvm/ioapic.c
@@ -73,9 +73,12 @@ static unsigned long ioapic_read_indirect(struct kvm_ioapic *ioapic,
u32 redir_index = (ioapic->ioregsel - 0x10) >> 1;
u64 redir_content;
- ASSERT(redir_index < IOAPIC_NUM_PINS);
+ if (redir_index < IOAPIC_NUM_PINS)
+ redir_content =
+ ioapic->redirtbl[redir_index].bits;
+ else
+ redir_content = ~0ULL;
- redir_content = ioapic->redirtbl[redir_index].bits;
result = (ioapic->ioregsel & 0x1) ?
(redir_content >> 32) & 0xffffffff :
redir_content & 0xffffffff;