Find a file
Eric Blake fed5f8f820 nbd/server: Fix error reporting for bad requests
The NBD spec says an attempt to NBD_CMD_TRIM on a read-only
export should fail with EPERM, as a trim has the potential
to change disk contents, but we were relying on the block
layer to catch that for us, which might not always give the
right error (and even if it does, it does not let us pass
back a sane message for structured replies).

The NBD spec says an attempt to NBD_CMD_WRITE_ZEROES out of
bounds should fail with ENOSPC, not EINVAL.

Our check for u64 offset + u32 length wraparound up front is
pointless; nothing uses offset until after the second round
of sanity checks, and we can just as easily ensure there is
no wraparound by checking whether offset is in bounds (since
a disk size cannot exceed off_t which is 63 bits, adding a
32-bit number for a valid offset can't overflow).  Bonus:
dropping the up-front check lets us keep the connection alive
after NBD_CMD_WRITE, whereas before we would drop the
connection (of course, any client sending a packet that would
trigger the failure is already buggy, so it's also okay to
drop the connection, but better quality-of-implementation
never hurts).

Solve all of these issues by some code motion and improved
request validation.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20171115213557.3548-1-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
2017-11-17 08:38:38 -06:00
accel Miscellaneous bugfixes 2017-11-16 14:42:54 +00:00
audio
backends
block nbd: Don't crash when server reports NBD_CMD_READ failure 2017-11-17 08:02:45 -06:00
bsd-user tcg: introduce regions to split code_gen_buffer 2017-10-24 13:53:42 -07:00
capstone@22ead3e0bf disas: Add capstone as submodule 2017-10-26 11:56:20 +02:00
chardev
contrib
crypto crypto: afalg: fix a NULL pointer dereference 2017-11-08 11:05:09 +00:00
default-configs build-sys: restrict vmcoreinfo to fw_cfg+dma capable targets 2017-11-16 17:46:53 +02:00
disas target/arm: Move BE32 disassembler fixup 2017-10-25 11:54:52 +02:00
docs specs: Extend TPM spec with TPM emulator description 2017-11-15 06:47:35 -05:00
dtc@558cd81bdd
fpu
fsdev
gdb-xml
hw pc, pci, virtio: fixes for rc1 2017-11-16 19:06:07 +00:00
include pc, pci, virtio: fixes for rc1 2017-11-16 19:06:07 +00:00
io
libdecnumber
linux-headers
linux-user sh4: simplify superh_cpu_class_by_name() 2017-10-27 16:03:55 +02:00
migration migration: Make xbzrle_cache_size a migration parameter 2017-10-29 14:06:15 +01:00
nbd nbd/server: Fix error reporting for bad requests 2017-11-17 08:38:38 -06:00
net net/socket: fix coverity issue 2017-11-13 18:05:12 +08:00
pc-bios seabios: update to 1.11 final 2017-11-14 15:36:08 +01:00
po
qapi migration: Make xbzrle_cache_size a migration parameter 2017-10-29 14:06:15 +01:00
qga qga-win: fix error-handling in getNameByStringSID() 2017-10-26 20:01:32 -05:00
qobject
qom tcg: Add CPUState cflags_next_tb 2017-10-24 13:53:41 -07:00
replay
roms seabios: update to 1.11 final 2017-11-14 15:36:08 +01:00
scripts Miscellaneous bugfixes 2017-11-16 14:42:54 +00:00
scsi
slirp slirp: don't zero the whole ti_i when m == NULL 2017-11-09 18:59:22 +01:00
stubs tpm: add stubs 2017-10-25 01:05:04 -04:00
target Miscellaneous bugfixes 2017-11-16 14:42:54 +00:00
tcg tcg/s390x: Use constant pool for prologue 2017-11-03 09:33:45 +01:00
tests tests/bios-tables-test: Fix endianess problems when passing data to iasl 2017-11-16 18:36:54 +02:00
trace
ui sdl2: Fix broken display updating after the window is hidden 2017-11-16 09:57:47 +01:00
util Miscellaneous bugfixes 2017-11-16 14:42:54 +00:00
.dir-locals.el
.editorconfig
.exrc
.gdbinit
.gitignore
.gitmodules disas: Add capstone as submodule 2017-10-26 11:56:20 +02:00
.mailmap MAINTAINERS: Update Paul Burton's email address 2017-11-06 07:36:43 -08:00
.shippable.yml
.travis.yml
arch_init.c
balloon.c
block.c block: don't add 'driver' to options when referring to backing via node name 2017-10-26 14:45:57 +02:00
blockdev-nbd.c
blockdev.c
blockjob.c
bootdevice.c
bt-host.c
bt-vhci.c
Changelog
CODING_STYLE
configure Makefile: Capstone: Add support for cross compile ranlib 2017-11-09 08:47:14 +01:00
COPYING
COPYING.LIB
COPYING.PYTHON
cpus-common.c
cpus.c tcg: enable multiple TCG contexts in softmmu 2017-10-24 13:53:42 -07:00
device-hotplug.c
device_tree.c
disas.c disas: Dump insn bytes along with capstone disassembly 2017-11-09 08:46:38 +01:00
dma-helpers.c
dump.c
exec.c Miscellaneous bugfixes 2017-11-16 14:42:54 +00:00
gdbstub.c
HACKING
hmp-commands-info.hx
hmp-commands.hx migrate: HMP migate_continue 2017-10-23 18:03:31 +02:00
hmp.c hmp: Replace error_report_err 2017-10-30 18:29:45 +00:00
hmp.h migrate: HMP migate_continue 2017-10-23 18:03:31 +02:00
ioport.c
iothread.c
LICENSE
MAINTAINERS MAINTAINERS: Add entries for Smartfusion2 2017-11-13 13:55:25 +00:00
Makefile Miscellaneous bugfixes 2017-11-16 14:42:54 +00:00
Makefile.objs tpm: add stubs 2017-10-25 01:05:04 -04:00
Makefile.target
memory.c
memory_ldst.inc.c
memory_mapping.c
module-common.c
monitor.c monitor: fix dangling CPU pointer 2017-10-30 18:46:32 +00:00
numa.c NUMA: Enable adding NUMA node implicitly 2017-11-16 17:46:53 +02:00
os-posix.c
os-win32.c
qapi-schema.json target/s390x: change CPU type name to "s390x-cpu" 2017-10-30 08:56:28 +01:00
qdev-monitor.c pci-assign: Remove 2017-11-05 14:52:10 +01:00
qdict-test-data.txt
qemu-bridge-helper.c
qemu-doc.texi xlnx-zcu102: Add an info message deprecating the EP108 2017-11-13 13:55:26 +00:00
qemu-ga.texi
qemu-img-cmds.hx
qemu-img.c qemu-img: Change img_compare() to be byte-based 2017-10-26 14:45:57 +02:00
qemu-img.texi qemu-img.1: Image invalidation on qemu-img commit 2017-10-26 14:59:18 +02:00
qemu-io-cmds.c qemu-io: Relax 'alloc' now that block-status doesn't assert 2017-10-26 14:45:57 +02:00
qemu-io.c
qemu-keymap.c
qemu-nbd.c
qemu-nbd.texi
qemu-option-trace.texi
qemu-options-wrapper.h
qemu-options.h
qemu-options.hx Add new PCI ID for i82559a 2017-11-13 15:48:54 +08:00
qemu-seccomp.c
qemu-tech.texi
qemu.nsi
qemu.sasl
qmp.c
qtest.c
README
replication.c
replication.h
rules.mak
thunk.c
tpm.c tpm: remove unnecessary #ifdef CONFIG_TPM 2017-10-25 01:05:35 -04:00
trace-events
VERSION Update version for v2.11.0-rc1 release 2017-11-14 18:37:49 +00:00
version.rc
vl.c NUMA: Enable adding NUMA node implicitly 2017-11-16 17:46:53 +02:00

         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

Additional information can also be found online via the QEMU website:

  http://qemu-project.org/Hosts/Linux
  http://qemu-project.org/Hosts/Mac
  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