qemu-e2k/include/hw/virtio
Michael S. Tsirkin 71f7fe48e1 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>
2014-05-05 14:15:10 +02:00
..
dataplane dataplane: replace hostmem with memory_region_find 2013-12-20 09:11:57 +01:00
vhost-scsi.h vhost-scsi: new device supporting the tcm_vhost Linux kernel module 2013-04-19 16:18:11 +02:00
vhost.h vhost: Add vhost_commit callback for SeaBIOS ROM region re-mapping 2013-04-19 10:44:17 +02:00
virtio-9p.h
virtio-balloon.h
virtio-blk.h dataplane: replace internal thread with IOThread 2014-03-13 14:42:24 +01:00
virtio-bus.h virtio-bus: cleanup plug/unplug interface 2013-12-09 21:46:48 +01:00
virtio-net.h virtio-net: fix buffer overflow on invalid state load 2014-05-05 14:15:10 +02:00
virtio-rng.h virtio-rng: Convert to QOM realize 2013-12-09 21:46:49 +01:00
virtio-scsi.h virtio: Convert exit to unrealize 2013-12-09 21:46:49 +01:00
virtio-serial.h virtio-serial-port: Convert to QOM realize/unrealize 2014-03-13 01:21:57 +01:00
virtio.h virtio: Convert exit to unrealize 2013-12-09 21:46:49 +01:00