xemu/include/hw
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
..
acpi acpi: add interface to access user-installed tables 2013-10-14 17:48:53 +03:00
arm pxa: Fix typo "dettach" 2013-11-05 18:06:51 +01:00
audio isa: QOM'ify ISADevice 2013-06-07 14:55:33 +02:00
block fdc: QOM'ify ISA floppy controller 2013-04-29 08:27:47 -05:00
char lm32_juart: QOM cast cleanup 2013-07-29 21:06:28 +02:00
cpu arm11mpcore: Prepare for QOM embedding 2013-11-05 17:47:30 +01:00
cris hw: move headers to include/ 2013-04-08 18:13:10 +02:00
i2c hw: move headers to include/ 2013-04-08 18:13:10 +02:00
i386 piix: fix 32bit pci hole 2014-02-20 21:59:18 -06:00
input input: introduce keyboard handler list 2013-04-24 11:50:18 -05:00
intc realview_gic: Prepare for QOM embedding 2013-11-05 17:47:30 +01:00
isa isa: Fix documentation of isa_register_portio_list() 2013-08-30 21:15:44 +02:00
kvm hw: move headers to include/ 2013-04-08 18:13:10 +02:00
lm32 lm32_juart: Relocate and tidy header 2013-07-29 21:06:27 +02:00
m68k hw: move headers to include/ 2013-04-08 18:13:10 +02:00
mips hw/mips: align initrd to 64KB to avoid kernel error 2013-07-29 00:27:35 +02:00
misc arm11mpcore: Split off SCU device 2013-11-05 17:47:30 +01:00
nvram loader: use file path size from fw_cfg.h 2013-10-14 17:48:52 +03:00
pci Revert "hw/pci: partially handle pci master abort" 2013-11-10 14:30:00 +02:00
pci-host pc: map PCI address space as catchall region for not mapped addresses 2014-02-20 21:59:18 -06:00
ppc spapr: Use DeviceClass::fw_name for device tree CPU node 2013-10-25 23:25:48 +02:00
s390x s390/sclplmconsole: Add support for SCLP line-mode console 2013-09-20 13:55:30 +02:00
scsi scsi: Change scsi sense buf size to 252 2014-06-25 15:05:09 -05:00
sh4 sh7750: Change cpu field type to SuperHCPU 2013-04-13 13:51:45 +02:00
sparc firmware_abi: move to include/hw/nvram/ 2013-06-02 18:13:54 +03:00
timer hpet: fix build with CONFIG_HPET off 2014-02-21 00:34:39 -06:00
unicore32 hw: move headers to include/ 2013-04-08 18:13:10 +02:00
virtio virtio-net: fix buffer overflow on invalid state load 2014-06-26 13:57:15 -05:00
xen pc: Initializing ram_memory under Xen. 2013-09-09 16:22:19 +00:00
boards.h hw: Clean up bogus default boot order 2013-08-28 10:16:47 +03:00
bt.h Preparation for usb-bt-dongle conditional build 2013-09-10 11:14:41 +02:00
devices.h arm: fix location of some include files 2013-04-15 15:16:01 +02:00
elf_ops.h hw: move headers to include/ 2013-04-08 18:13:10 +02:00
empty_slot.h hw: move headers to include/ 2013-04-08 18:13:10 +02:00
hw.h linux-user: Fix compilation failure 2013-06-27 15:38:35 -05:00
ide.h hw: move headers to include/ 2013-04-08 18:13:10 +02:00
irq.h hw/core: Add interface to allocate and free a single IRQ 2013-10-14 17:11:44 +03:00
loader.h loader: drop return value for rom_add_blob_fixed 2013-11-10 12:08:38 +02:00
pcmcia.h pcmcia: QOM'ify PCMCIACardState and MicroDriveState 2013-11-05 18:06:52 +01:00
ptimer.h hw: move headers to include/ 2013-04-08 18:13:10 +02:00
qdev-core.h qdev: Drop misleading qdev_free() function 2013-11-05 18:06:38 +01:00
qdev-dma.h hw: move headers to include/ 2013-04-08 18:13:10 +02:00
qdev-properties.h qdev: Add SIZE type to qdev properties 2013-07-29 19:33:33 -05:00
qdev.h hw: move headers to include/ 2013-04-08 18:13:10 +02:00
sd.h hw: move headers to include/ 2013-04-08 18:13:10 +02:00
ssi.h hw: move headers to include/ 2013-04-08 18:13:10 +02:00
stream.h Trivial grammar and spelling fixes 2013-05-01 20:55:21 +04:00
sysbus.h memory: Change MemoryRegion priorities from unsigned to signed 2013-10-14 17:11:44 +03:00
usb.h Remove dev-bluetooth.c dependency from vl.c 2013-09-10 11:14:42 +02:00
xilinx.h stream: Remove app argument hack 2013-04-16 10:04:23 +02:00