xemu/include
Michael S. Tsirkin 95f118fa82 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-06-26 13:57:15 -05:00
..
block coroutine: add co_aio_sleep_ns() to allow sleep in block drivers 2013-10-30 12:22:09 +01:00
disas Add moxie disassembler 2013-03-23 14:25:41 +00:00
exec pci, pc, acpi fixes, enhancements 2013-10-31 16:58:32 +01:00
fpu softfloat: Implement uint64_to_float128 2013-01-05 10:12:50 +00:00
hw virtio-net: fix buffer overflow on invalid state load 2014-06-26 13:57:15 -05:00
migration vmstate: add VMSTATE_VALIDATE 2014-06-26 13:55:15 -05:00
monitor Merge remote-tracking branch 'kwolf/for-anthony' into staging 2013-09-03 12:32:46 -05:00
net net: disallow to specify multicast MAC address 2013-11-08 17:32:34 +01:00
qapi qemu-ga: Extend 'guest-info' command to expose flag 'success-response' 2013-10-10 14:52:37 -05:00
qemu atomic.h: Fix build with clang 2013-11-21 17:38:57 +01:00
qom qom: Split out object and class caches 2014-02-20 21:59:18 -06:00
sysemu qmp: access the local QemuOptsLists for drive option 2013-11-14 13:09:07 +01:00
ui spice: fix multihead support 2013-10-17 12:42:54 +02:00
config.h janitor: move remaining public headers to include/ 2012-12-19 08:32:46 +01:00
elf.h target-ppc: dump-guest-memory support 2013-10-25 23:25:48 +02:00
glib-compat.h glib: add a compatibility interface for g_timeout_add_seconds 2013-03-25 13:10:40 -05:00
qemu-common.h qmp: add interface blockdev-snapshot-delete-internal-sync 2013-09-12 10:12:47 +02:00
qemu-io.h qemu-io: Interface cleanup 2013-06-06 11:27:05 +02:00
trace.h build: some simplifications for "trace/Makefile.objs" 2013-01-12 18:42:51 +01:00