qemu-patch-raspberry4/include
Stefan Hajnoczi 7bd04a041a virtio-blk: undo destructive iov_discard_*() operations
Fuzzing discovered that virtqueue_unmap_sg() is being called on modified
req->in/out_sg iovecs. This means dma_memory_map() and
dma_memory_unmap() calls do not have matching memory addresses.

Fuzzing discovered that non-RAM addresses trigger a bug:

  void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len,
                           bool is_write, hwaddr access_len)
  {
      if (buffer != bounce.buffer) {
          ^^^^^^^^^^^^^^^^^^^^^^^

A modified iov->iov_base is no longer recognized as a bounce buffer and
the wrong branch is taken.

There are more potential bugs: dirty memory is not tracked correctly and
MemoryRegion refcounts can be leaked.

Use the new iov_discard_undo() API to restore elem->in/out_sg before
virtqueue_push() is called.

Fixes: 827805a249 ("virtio-blk: Convert VirtIOBlockReq.out to structrue")
Reported-by: Alexander Bulekov <alxndr@bu.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Buglink: https://bugs.launchpad.net/qemu/+bug/1890360
Message-Id: <20200917094455.822379-3-stefanha@redhat.com>
2020-09-23 13:41:58 +01:00
..
authz qom: Remove module_obj_name parameter from OBJECT_DECLARE* macros 2020-09-18 14:12:32 -04:00
block Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
chardev Use OBJECT_DECLARE_TYPE when possible 2020-09-18 14:12:32 -04:00
crypto qom: Remove module_obj_name parameter from OBJECT_DECLARE* macros 2020-09-18 14:12:32 -04:00
disas target/avr: Register AVR support with the rest of QEMU 2020-07-11 11:02:05 +02:00
exec Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
fpu softfloat: Define comparison operations for bfloat16 2020-08-29 19:25:42 -07:00
hw virtio-blk: undo destructive iov_discard_*() operations 2020-09-23 13:41:58 +01:00
io Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
libdecnumber include: Make headers more self-contained 2019-08-16 13:31:51 +02:00
migration migration/colo: Use ram_block_discard_disable() 2020-07-02 05:54:59 -04:00
monitor monitor: simplify functions for getting a dup'd fdset entry 2020-09-16 10:33:48 +01:00
net Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
qapi qapi/error: Check format string argument in error_*prepend() 2020-07-24 15:03:09 +02:00
qemu util/iov: add iov_discard_undo() 2020-09-23 13:41:58 +01:00
qom qom: Remove module_obj_name parameter from OBJECT_DECLARE* macros 2020-09-18 14:12:32 -04:00
scsi qom: Remove module_obj_name parameter from OBJECT_DECLARE* macros 2020-09-18 14:12:32 -04:00
standard-headers Linux headers: update 2020-06-18 12:13:36 +02:00
sysemu Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
tcg tcg: Add tcg_get_insn_start_param 2020-09-01 07:43:30 -07:00
ui input: tsc2xxx fix. 2020-09-22 21:11:10 +01:00
user trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
elf.h Update PowerPC AT_HWCAP2 definition 2020-08-12 13:16:27 +10:00
glib-compat.h glib: bump min required glib library version to 2.48 2019-08-22 10:46:34 +01:00
qemu-common.h util/hexdump: Reorder qemu_hexdump() arguments 2020-09-11 21:25:59 +02:00
qemu-io.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
trace-tcg.h trace: get rid of generated-events.h/generated-events.c 2016-10-12 09:54:52 +02:00