qemu-irix/include/hw
Michael S. Tsirkin 7872f3e77e virtio-net: fix buffer overflow on invalid state load
CVE-2013-4148 QEMU 1.0 integer conversion in
virtio_net_load()@hw/net/virtio-net.c

Deals with loading a corrupted savevm image.

>         n->mac_table.in_use = qemu_get_be32(f);

in_use is int so it can get negative when assigned 32bit unsigned value.

>         /* MAC_TABLE_ENTRIES may be different from the saved image */
>         if (n->mac_table.in_use <= MAC_TABLE_ENTRIES) {

passing this check ^^^

>             qemu_get_buffer(f, n->mac_table.macs,
>                             n->mac_table.in_use * ETH_ALEN);

with good in_use value, "n->mac_table.in_use * ETH_ALEN" can get
positive and bigger than mac_table.macs. For example 0x81000000
satisfies this condition when ETH_ALEN is 6.

Fix it by making the value unsigned.
For consistency, change first_multi as well.

Note: all call sites were audited to confirm that
making them unsigned didn't cause any issues:
it turns out we actually never do math on them,
so it's easy to validate because both values are
always <= MAC_TABLE_ENTRIES.

Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
(cherry picked from commit 71f7fe48e1)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2014-07-20 22:05:53 -05:00
..
acpi acpi: Add ACPI_CPU_HOTPLUG_ID_LIMIT macro 2014-03-18 16:08:42 +02:00
arm
audio
block
char
cpu
cris
i2c
i386
input
intc
ipack
isa
kvm
lm32
m68k
mips
misc
net
nvram
pci
pci-host
ppc PPC: Clean up DECR implementation 2014-04-08 11:20:04 +02:00
s390x
scsi scsi: Fix migration of scsi sense data 2014-03-14 10:06:55 +01:00
sh4
sparc
timer
unicore32
virtio virtio-net: fix buffer overflow on invalid state load 2014-07-20 22:05:53 -05:00
xen Revert "KVM: Split QEMUMachine typedef into separate header" 2014-03-13 03:49:48 +01:00
boards.h vl.c: Fix OpenBSD compilation issue due to namespace collisions 2014-03-19 21:00:34 +01:00
bt.h
devices.h
elf_ops.h
empty_slot.h
fw-path-provider.h fw-path-provider: Change GPL version to 2+ 2014-04-07 15:36:07 +02:00
hotplug.h
hw.h
ide.h
irq.h
loader.h
pcmcia.h
ptimer.h
qdev-core.h qdev: Prepare realize/unrealize hooks for BusState 2014-03-13 01:21:57 +01:00
qdev-dma.h
qdev-properties.h qom: Add check() argument to object_property_add_link() 2014-03-19 22:23:13 +01:00
qdev.h
sd.h
ssi.h
stream.h
sysbus.h
usb.h