aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2019-10-10 12:08:58 +0200
committerKevin Wolf <kwolf@redhat.com>2019-10-14 17:12:48 +0200
commita1406a9262a087d9ec9627b88da13c4590b61dae (patch)
tree3cdda71e2e0106b0b8c95ade05c1064577def867 /docs
parentd1b9d19f99586b33795e20a79f645186ccbc070f (diff)
downloadqemu-a1406a9262a087d9ec9627b88da13c4590b61dae.zip
qemu-a1406a9262a087d9ec9627b88da13c4590b61dae.tar.gz
qemu-a1406a9262a087d9ec9627b88da13c4590b61dae.tar.bz2
iotests: Test large write request to qcow2 file
Without HEAD^, the following happens when you attempt a large write request to a qcow2 file such that the number of bytes covered by all clusters involved in a single allocation will exceed INT_MAX: (A) handle_alloc_space() decides to fill the whole area with zeroes and fails because bdrv_co_pwrite_zeroes() fails (the request is too large). (B) If handle_alloc_space() does not do anything, but merge_cow() decides that the requests can be merged, it will create a too long IOV that later cannot be written. (C) Otherwise, all parts will be written separately, so those requests will work. In either B or C, though, qcow2_alloc_cluster_link_l2() will have an overflow: We use an int (i) to iterate over nb_clusters, and then calculate the L2 entry based on "i << s->cluster_bits" -- which will overflow if the range covers more than INT_MAX bytes. This then leads to image corruption because the L2 entry will be wrong (it will be recognized as a compressed cluster). Even if that were not the case, the .cow_end area would be empty (because handle_alloc() will cap avail_bytes and nb_bytes at INT_MAX, so their difference (which is the .cow_end size) will be 0). So this test checks that on such large requests, the image will not be corrupted. Unfortunately, we cannot check whether COW will be handled correctly, because that data is discarded when it is written to null-co (but we have to use null-co, because writing 2 GB of data in a test is not quite reasonable). Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'docs')
0 files changed, 0 insertions, 0 deletions