summary refs log tree commit diff stats
path: root/util/qemu-coroutine-sleep.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2020-09-17 10:44:55 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2020-09-23 13:41:58 +0100
commit8080747748f143c71076e1fd9951ca40900da574 (patch)
treeb6760b3ab8cf0c495f18e335b6a88694d6983a93 /util/qemu-coroutine-sleep.c
parent7bd04a041addcdef6a03e6498aafaea55ca6e88b (diff)
downloadfocaccia-qemu-8080747748f143c71076e1fd9951ca40900da574.tar.gz
focaccia-qemu-8080747748f143c71076e1fd9951ca40900da574.zip
virtio-crypto: don't modify elem->in/out_sg
A number of iov_discard_front/back() operations are made by
virtio-crypto. The elem->in/out_sg iovec arrays are modified by these
operations, resulting virtqueue_unmap_sg() calls on different addresses
than were originally mapped.

This is problematic because dirty memory may not be logged correctly,
MemoryRegion refcounts may be leaked, and the non-RAM bounce buffer can
be leaked.

Take a copy of the elem->in/out_sg arrays so that the originals are
preserved. The iov_discard_undo() API could be used instead (with better
performance) but requires careful auditing of the code, so do the simple
thing instead.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Message-Id: <20200917094455.822379-4-stefanha@redhat.com>
Diffstat (limited to 'util/qemu-coroutine-sleep.c')
0 files changed, 0 insertions, 0 deletions