adding Irix (and, to a lesser extent, Solaris) userland emulation to QEMU
Go to file
Laszlo Ersek cb873eaa6d e1000: eliminate infinite loops on out-of-bounds transfer start
The start_xmit() and e1000_receive_iov() functions implement DMA transfers
iterating over a set of descriptors that the guest's e1000 driver
prepares:

- the TDLEN and RDLEN registers store the total size of the descriptor
  area,

- while the TDH and RDH registers store the offset (in whole tx / rx
  descriptors) into the area where the transfer is supposed to start.

Each time a descriptor is processed, the TDH and RDH register is bumped
(as appropriate for the transfer direction).

QEMU already contains logic to deal with bogus transfers submitted by the
guest:

- Normally, the transmit case wants to increase TDH from its initial value
  to TDT. (TDT is allowed to be numerically smaller than the initial TDH
  value; wrapping at or above TDLEN bytes to zero is normal.) The failsafe
  that QEMU currently has here is a check against reaching the original
  TDH value again -- a complete wraparound, which should never happen.

- In the receive case RDH is increased from its initial value until
  "total_size" bytes have been received; preferably in a single step, or
  in "s->rxbuf_size" byte steps, if the latter is smaller. However, null
  RX descriptors are skipped without receiving data, while RDH is
  incremented just the same. QEMU tries to prevent an infinite loop
  (processing only null RX descriptors) by detecting whether RDH assumes
  its original value during the loop. (Again, wrapping from RDLEN to 0 is
  normal.)

What both directions miss is that the guest could program TDLEN and RDLEN
so low, and the initial TDH and RDH so high, that these registers will
immediately be truncated to zero, and then never reassume their initial
values in the loop -- a full wraparound will never occur.

The condition that expresses this is:

  xdh_start >= s->mac_reg[XDLEN] / sizeof(desc)

i.e., TDH or RDH start out after the last whole rx or tx descriptor that
fits into the TDLEN or RDLEN sized area.

This condition could be checked before we enter the loops, but
pci_dma_read() / pci_dma_write() knows how to fill in buffers safely for
bogus DMA addresses, so we just extend the existing failsafes with the
above condition.

This is CVE-2016-1981.

Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Petr Matousek <pmatouse@redhat.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Prasad Pandit <ppandit@redhat.com>
Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: qemu-stable@nongnu.org
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1296044
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
(cherry picked from commit dd793a7488)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2016-03-17 16:55:27 -05:00
audio
backends hostmem: Ignore ENOSYS while setting MPOL_DEFAULT 2015-11-23 10:43:38 -02:00
block block/raw-posix: avoid bogus fixup for cylinders on DASD disks 2016-03-17 16:41:43 -05:00
bsd-user translate-all: ensure host page mask is always extended with 1's 2015-12-02 13:12:30 +01:00
contrib
crypto crypto: avoid two coverity false positive error reports 2015-12-04 09:39:55 +03:00
default-configs default-configs/aarch64-linux-user.mak: Remove unused define 2015-11-24 14:12:15 +00:00
disas disas/arm: avoid clang shifting negative signed warning 2015-11-17 18:35:56 +08:00
docs vhost-user: clarify start and enable 2015-11-25 13:42:38 +02:00
dtc@65cc4d2748
fpu
fsdev fsdev-proxy-helper: avoid TOC/TOU race 2015-11-30 12:31:53 +01:00
gdb-xml
hw e1000: eliminate infinite loops on out-of-bounds transfer start 2016-03-17 16:55:27 -05:00
include block: set device_list.tqe_prev to NULL on BDS removal 2016-03-17 16:51:48 -05:00
libdecnumber
linux-headers vhost: rename RESET_DEVICE backto RESET_OWNER 2015-11-12 15:49:33 +02:00
linux-user translate-all: ensure host page mask is always extended with 1's 2015-12-02 13:12:30 +01:00
migration Fix xbzrle vs last_sent_block update 2015-12-11 12:51:27 +00:00
net net/filter: fix nf->netdev_id leak 2016-03-17 16:34:23 -05:00
pc-bios pc-bios/s390-ccw: rebuild image 2015-12-01 09:57:27 +01:00
pixman@87eea99e44
po Update language files for QEMU 2.5.0 2015-12-10 13:50:45 +00:00
qapi qmp: Fix reference-counting of qnull on empty output visit 2016-03-17 16:50:34 -05:00
qga QMP and QObject patches 2015-11-26 16:27:26 +00:00
qobject qjson: Limit number of tokens in addition to total size 2015-11-26 10:07:07 +01:00
qom qom: Clean up assertions to display values on failure 2015-11-19 15:15:33 +01:00
replay
roms
scripts
slirp slirp: Fix type casts and format strings in debug code 2015-11-12 13:48:36 +08:00
stubs main-loop: suppress warnings under qtest 2015-12-02 12:01:43 +01:00
target-alpha
target-arm target-arm/translate-a64.c: Correct unallocated checks for ldst_excl 2015-11-24 14:12:15 +00:00
target-cris
target-i386 target-i386: kvm: Print warning when clearing mcg_cap bits 2015-11-26 16:48:16 +01:00
target-lm32
target-m68k
target-microblaze
target-mips target-mips: flush QEMU TLB when disabling 64-bit addressing 2015-11-24 11:01:03 +00:00
target-moxie
target-openrisc
target-ppc target-ppc: kvm: fix floating point registers sync on little-endian hosts 2016-03-15 12:10:47 -05:00
target-s390x s390x/ioinst: set type and len for SEI response 2016-03-17 16:42:13 -05:00
target-sh4
target-sparc sparc: allow CASA with ASI 0xa from user space 2015-12-10 11:19:18 +00:00
target-tilegx
target-tricore
target-unicore32
target-xtensa
tcg tcg: Increase the highwater reservation 2015-12-01 14:36:32 -08:00
tests block: qemu-iotests - add test for snapshot, commit, snapshot bug 2016-03-17 16:53:35 -05:00
trace trace/simple: Fix warning and wrong trace file name for MinGW 2015-11-30 06:47:02 +01:00
ui ui: vnc: avoid floating point exception 2015-12-03 13:34:50 +00:00
util util/id: fully allocate names table 2015-12-04 09:39:55 +03:00
.dir-locals.el
.exrc
.gitignore
.gitmodules
.mailmap
.travis.yml
CODING_STYLE
COPYING
COPYING.LIB
Changelog
HACKING
LICENSE
MAINTAINERS MAINTAINERS: add maintainer to virtio-9p 2015-12-10 11:17:25 +00:00
Makefile makefile: fix qemu-ga make install for --disable-tools 2015-11-25 10:21:54 -06:00
Makefile.objs
Makefile.target
README
VERSION Update version for v2.5.0 release 2015-12-16 16:10:14 +00:00
accel.c
aio-posix.c aio-epoll: Fix use-after-free of node 2015-11-17 18:35:57 +08:00
aio-win32.c
arch_init.c
async.c
balloon.c
block.c block: set device_list.tqe_prev to NULL on BDS removal 2016-03-17 16:51:48 -05:00
blockdev-nbd.c
blockdev.c block: set device_list.tqe_prev to NULL on BDS removal 2016-03-17 16:51:48 -05:00
blockjob.c block: Add block job transactions 2015-11-12 16:22:44 +01:00
bootdevice.c
bt-host.c
bt-vhci.c
configure configure: Fix shell syntax to placate OpenBSD's pdksh 2016-03-15 12:19:47 -05:00
cpu-exec-common.c
cpu-exec.c
cpus.c cpus: use broadcast on qemu_pause_cond 2016-03-17 16:47:04 -05:00
cputlb.c
device-hotplug.c
device_tree.c
disas.c
dma-helpers.c
dump.c
exec.c exec: Stop using memory after free 2015-12-02 12:01:43 +01:00
gdbstub.c
hmp-commands-info.hx
hmp-commands.hx migrate-start-postcopy: Improve text 2015-11-12 17:54:39 +01:00
hmp.c block: Add idle_time_ns to BlockDeviceStats 2015-11-12 16:22:45 +01:00
hmp.h
iohandler.c
ioport.c
iothread.c iothread: include id in thread name 2015-12-03 11:08:01 +08:00
kvm-all.c KVM: add support for any length io eventfd 2015-11-12 15:49:32 +02:00
kvm-stub.c KVM: add support for any length io eventfd 2015-11-12 15:49:32 +02:00
main-loop.c main-loop: suppress warnings under qtest 2015-12-02 12:01:43 +01:00
memory.c memory: don't try to adjust endianness for zero length eventfd 2015-11-12 15:49:32 +02:00
memory_mapping.c
module-common.c
monitor.c qjson: store tokens in a GQueue 2015-11-26 10:07:07 +01:00
nbd.c
numa.c
os-posix.c
os-win32.c
page_cache.c
qapi-schema.json input: Document why x-input-send-event is still experimental 2015-11-17 08:42:07 +01:00
qdev-monitor.c
qdict-test-data.txt
qemu-bridge-helper.c
qemu-char.c qemu-char: retry g_poll on EINTR 2015-12-02 12:01:43 +01:00
qemu-doc.texi ivshmem: Rename property memdev to x-memdev for 2.5 2015-11-25 10:24:27 +01:00
qemu-ga.texi
qemu-img-cmds.hx
qemu-img.c blockjob: Introduce reference count and fix reference to job->bs 2015-11-12 16:22:43 +01:00
qemu-img.texi
qemu-io-cmds.c qemu-io: Account for failed, invalid and flush operations 2015-11-12 16:22:46 +01:00
qemu-io.c
qemu-log.c
qemu-nbd.c
qemu-nbd.texi
qemu-options-wrapper.h
qemu-options.h
qemu-options.hx
qemu-seccomp.c seccomp: add cacheflush to whitelist 2015-11-16 09:48:53 +01:00
qemu-tech.texi
qemu-timer.c
qemu.nsi
qemu.sasl
qjson.c
qmp-commands.hx blockdev: Mark {insert, remove}-medium experimental 2015-12-11 15:39:29 +00:00
qmp.c qmp: Convert QMP code to use object property iterators 2015-11-18 21:13:48 +01:00
qtest.c
rules.mak
softmmu_template.h
spice-qemu-char.c
tcg-runtime.c
tci.c
thread-pool.c
thunk.c
tpm.c
trace-events block: Don't wait serialising for non-COR read requests 2015-12-03 11:08:07 +08:00
translate-all.c translate-all: ensure host page mask is always extended with 1's 2015-12-02 13:12:30 +01:00
translate-all.h
translate-common.c translate-all: ensure host page mask is always extended with 1's 2015-12-02 13:12:30 +01:00
user-exec.c
version.rc
vl.c Revert "exec: silence hugetlbfs warning under qtest" 2015-11-26 16:47:44 +01:00
xen-common-stub.c
xen-common.c
xen-hvm-stub.c
xen-hvm.c
xen-mapcache.c

README

         QEMU README
         ===========

QEMU is a generic and open source machine & userspace emulator and
virtualizer.

QEMU is capable of emulating a complete machine in software without any
need for hardware virtualization support. By using dynamic translation,
it achieves very good performance. QEMU can also integrate with the Xen
and KVM hypervisors to provide emulated hardware while allowing the
hypervisor to manage the CPU. With hypervisor support, QEMU can achieve
near native performance for CPUs. When QEMU emulates CPUs directly it is
capable of running operating systems made for one machine (e.g. an ARMv7
board) on a different machine (e.g. an x86_64 PC board).

QEMU is also capable of providing userspace API virtualization for Linux
and BSD kernel interfaces. This allows binaries compiled against one
architecture ABI (e.g. the Linux PPC64 ABI) to be run on a host using a
different architecture ABI (e.g. the Linux x86_64 ABI). This does not
involve any hardware emulation, simply CPU and syscall emulation.

QEMU aims to fit into a variety of use cases. It can be invoked directly
by users wishing to have full control over its behaviour and settings.
It also aims to facilitate integration into higher level management
layers, by providing a stable command line interface and monitor API.
It is commonly invoked indirectly via the libvirt library when using
open source applications such as oVirt, OpenStack and virt-manager.

QEMU as a whole is released under the GNU General Public License,
version 2. For full licensing details, consult the LICENSE file.


Building
========

QEMU is multi-platform software intended to be buildable on all modern
Linux platforms, OS-X, Win32 (via the Mingw64 toolchain) and a variety
of other UNIX targets. The simple steps to build QEMU are:

  mkdir build
  cd build
  ../configure
  make

Complete details of the process for building and configuring QEMU for
all supported host platforms can be found in the qemu-tech.html file.
Additional information can also be found online via the QEMU website:

  http://qemu-project.org/Hosts/Linux
  http://qemu-project.org/Hosts/W32


Submitting patches
==================

The QEMU source code is maintained under the GIT version control system.

   git clone git://git.qemu-project.org/qemu.git

When submitting patches, the preferred approach is to use 'git
format-patch' and/or 'git send-email' to format & send the mail to the
qemu-devel@nongnu.org mailing list. All patches submitted must contain
a 'Signed-off-by' line from the author. Patches should follow the
guidelines set out in the HACKING and CODING_STYLE files.

Additional information on submitting patches can be found online via
the QEMU website

  http://qemu-project.org/Contribute/SubmitAPatch
  http://qemu-project.org/Contribute/TrivialPatches


Bug reporting
=============

The QEMU project uses Launchpad as its primary upstream bug tracker. Bugs
found when running code built from QEMU git or upstream released sources
should be reported via:

  https://bugs.launchpad.net/qemu/

If using QEMU via an operating system vendor pre-built binary package, it
is preferable to report bugs to the vendor's own bug tracker first. If
the bug is also known to affect latest upstream code, it can also be
reported via launchpad.

For additional information on bug reporting consult:

  http://qemu-project.org/Contribute/ReportABug


Contact
=======

The QEMU community can be contacted in a number of ways, with the two
main methods being email and IRC

 - qemu-devel@nongnu.org
   http://lists.nongnu.org/mailman/listinfo/qemu-devel
 - #qemu on irc.oftc.net

Information on additional methods of contacting the community can be
found online via the QEMU website:

  http://qemu-project.org/Contribute/StartHere

-- End