qemu-patch-raspberry4/include
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
..
block block: Unlink temporary files in raw-posix/win32 2014-04-30 11:05:00 +02:00
disas disas: Implement disassembly output for A64 2014-02-08 14:50:48 +00:00
exec tcg: Fix missed pointer size != TCG_TARGET_REG_BITS changes 2014-04-28 11:06:34 -07:00
fpu softfloat: Introduce float32_to_uint64_round_to_zero 2014-04-08 11:20:00 +02:00
hw virtio-net: fix buffer overflow on invalid state load 2014-05-05 14:15:10 +02:00
migration vmstate: add VMSTATE_VALIDATE 2014-05-05 14:15:10 +02:00
monitor monitor: Remove unused monitor_print_filename 2014-04-25 09:19:58 -04:00
net net: remove implicit peer from offload API 2014-02-25 14:31:05 +01:00
qapi error: Remove some unused headers 2014-04-25 09:19:59 -04:00
qemu trivial patches for 2014-04-28 2014-04-28 13:43:17 +01:00
qom cpu: Avoid QOM casts for CPU() 2014-03-31 19:28:38 +02:00
sysemu kvm: add kvm_{vm,vcpu}_enable_cap 2014-04-30 14:39:39 +02:00
ui gtk: Allow to activate grab-on-hover from the command line 2014-03-17 14:33:55 +01:00
config.h janitor: move remaining public headers to include/ 2012-12-19 08:32:46 +01:00
elf.h tcg-s390: Use qemu_getauxval in query_facilities 2013-11-30 07:45:30 +13: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 util: add qemu_ether_ntoa 2014-03-27 15:18:45 +05:30
qemu-io.h qemu-io: Fix warnings from static code analysis 2014-03-13 14:42:24 +01:00
trace.h build: some simplifications for "trace/Makefile.objs" 2013-01-12 18:42:51 +01:00