qemu-patch-raspberry4/block
Alberto Garcia e4d7019e1a qcow2: Avoid integer wraparound in qcow2_co_truncate()
After commit f01643fb8b when an image is
extended and BDRV_REQ_ZERO_WRITE is set then the new clusters are
zeroized.

The code however does not detect correctly situations when the old and
the new end of the image are within the same cluster. The problem can
be reproduced with these steps:

   qemu-img create -f qcow2 backing.qcow2 1M
   qemu-img create -f qcow2 -F qcow2 -b backing.qcow2 top.qcow2
   qemu-img resize --shrink top.qcow2 520k
   qemu-img resize top.qcow2 567k

In the last step offset - zero_start causes an integer wraparound.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Message-Id: <20200504155217.10325-1-berto@igalia.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2020-05-08 13:26:35 +02:00
..
monitor Use &error_abort instead of separate assert() 2020-03-17 16:05:40 +01:00
accounting.c block: add empty account cookie type 2019-10-10 10:56:18 +02:00
aio_task.c block: introduce aio task pool 2019-10-10 10:56:17 +02:00
backup-top.c block/block-copy: hide structure definitions 2020-03-11 12:42:30 +01:00
backup-top.h block: introduce backup-top filter driver 2019-10-10 10:56:18 +02:00
backup.c backup: don't acquire aio_context in backup_clean 2020-04-07 14:34:47 +02:00
blkdebug.c blkdebug: Allow taking/unsharing permissions 2020-01-06 13:43:06 +01:00
blklogwrites.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
blkreplay.c block: implement bdrv_snapshot_goto for blkreplay 2019-10-14 17:12:48 +02:00
blkverify.c block: Remove bdrv_recurse_is_first_non_filter() 2020-02-18 11:55:40 +01:00
block-backend.c block: Add blk_new_with_bs() helper 2020-05-05 13:17:36 +02:00
block-copy.c block/block-copy: use aio-task-pool API 2020-05-05 14:03:28 +02:00
bochs.c block: Use QEMU_IS_ALIGNED 2019-09-16 14:48:30 +02:00
cloop.c block: Use QEMU_IS_ALIGNED 2019-09-16 14:48:30 +02:00
commit.c block-backend: Add flags to blk_truncate() 2020-04-30 17:51:07 +02:00
copy-on-read.c block: Remove bdrv_recurse_is_first_non_filter() 2020-02-18 11:55:40 +01:00
create.c block/create: Do not abort if a block driver is not available 2019-09-13 12:18:37 +02:00
crypto.c block: luks: better error message when creating too large files 2020-05-07 12:52:33 +01:00
crypto.h Clean up ill-advised or unusual header guards 2019-05-13 08:58:55 +02:00
curl.c block/curl: HTTP header field names are case insensitive 2020-03-11 12:42:29 +01:00
dirty-bitmap.c block/dirty-bitmap: improve _next_dirty_area API 2020-03-18 14:03:46 -04:00
dmg-bz2.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
dmg-lzfse.c block: adding lzfse decompressing support as a module. 2018-12-14 11:52:40 +01:00
dmg.c block: Use QEMU_IS_ALIGNED 2019-09-16 14:48:30 +02:00
dmg.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
file-posix.c Compress lines for immediate return 2020-05-04 14:43:22 +02:00
file-win32.c block: Add flags to BlockDriver.bdrv_co_truncate() 2020-04-30 17:51:07 +02:00
filter-compress.c block: Remove bdrv_recurse_is_first_non_filter() 2020-02-18 11:55:40 +01:00
gluster.c block: Add flags to BlockDriver.bdrv_co_truncate() 2020-04-30 17:51:07 +02:00
io.c block: Comment cleanups 2020-05-05 13:17:36 +02:00
io_uring.c block/io_uring: Remove superfluous semicolon 2020-02-18 10:54:02 +01:00
iscsi-opts.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
iscsi.c lockable: replaced locks with lock guard macros where appropriate 2020-05-04 16:07:43 +01:00
linux-aio.c misc: Replace zero-length arrays with flexible array member (automatic) 2020-03-16 22:07:42 +01:00
Makefile.objs monitor/hmp: rename device-hotplug.c to block/monitor/block-hmp-cmds.c 2020-03-09 18:05:31 +00:00
mirror.c block-backend: Add flags to blk_truncate() 2020-04-30 17:51:07 +02:00
nbd.c block/nbd-client: drop max_block restriction from discard 2020-05-04 15:16:46 -05:00
nfs.c trivial patches (20200504) 2020-05-05 14:03:28 +01:00
null.c replay: add BH oneshot event for block layer 2019-10-14 17:12:48 +02:00
nvme.c Compress lines for immediate return 2020-05-04 14:43:22 +02:00
parallels.c block: Add blk_new_with_bs() helper 2020-05-05 13:17:36 +02:00
parallels.h Clean up includes 2018-02-09 05:05:11 +01:00
qapi-sysemu.c block: Move system emulator QMP commands to block/qapi-sysemu.c 2020-03-06 17:15:38 +01:00
qapi.c block: Fix VM size field width in snapshot dump 2020-02-20 16:43:42 +01:00
qcow.c block: Add blk_new_with_bs() helper 2020-05-05 13:17:36 +02:00
qcow2-bitmap.c block/qcow2-bitmap: use bdrv_dirty_bitmap_next_dirty 2020-03-18 14:03:46 -04:00
qcow2-cache.c core: replace getpagesize() with qemu_real_host_page_size 2019-10-26 15:38:06 +02:00
qcow2-cluster.c qcow2: Support BDRV_REQ_ZERO_WRITE for truncate 2020-04-30 17:51:07 +02:00
qcow2-refcount.c block: Comment cleanups 2020-05-05 13:17:36 +02:00
qcow2-snapshot.c qcow2: Allow resize of images with internal snapshots 2020-05-05 13:17:36 +02:00
qcow2-threads.c block/qcow2-threads: fix qcow2_decompress 2020-03-11 12:42:30 +01:00
qcow2.c qcow2: Avoid integer wraparound in qcow2_co_truncate() 2020-05-08 13:26:35 +02:00
qcow2.h qcow2: Remove unused fields from BDRVQcow2State 2020-03-27 14:47:23 +01:00
qed-check.c block/qed: add missed coroutine_fn markers 2019-04-30 15:29:00 +02:00
qed-cluster.c qed: protect table cache with CoMutex 2017-07-17 11:34:11 +08:00
qed-l2-cache.c qed: protect table cache with CoMutex 2017-07-17 11:34:11 +08:00
qed-table.c block/qed: add missed coroutine_fn markers 2019-04-30 15:29:00 +02:00
qed.c block: Add blk_new_with_bs() helper 2020-05-05 13:17:36 +02:00
qed.h block/qed: add missed coroutine_fn markers 2019-04-30 15:29:00 +02:00
quorum.c quorum: Stop marking it as a filter 2020-02-18 11:55:40 +01:00
raw-format.c raw-format: Support BDRV_REQ_ZERO_WRITE for truncate 2020-04-30 17:51:07 +02:00
rbd.c block: Add flags to BlockDriver.bdrv_co_truncate() 2020-04-30 17:51:07 +02:00
replication.c various: Remove suspicious '\' character outside of #define in C code 2020-04-29 08:01:51 +02:00
sheepdog.c block: Add blk_new_with_bs() helper 2020-05-05 13:17:36 +02:00
snapshot.c block/snapshot: rename Error ** parameter to more common errp 2019-12-18 08:43:19 +01:00
ssh.c block: Add flags to BlockDriver.bdrv_co_truncate() 2020-04-30 17:51:07 +02:00
stream.c block/stream: Remove redundant statement in stream_run() 2020-03-09 15:59:31 +01:00
throttle-groups.c throttle-groups: fix memory leak in throttle_group_set_limit: 2020-01-06 13:43:06 +01:00
throttle.c block: Remove bdrv_recurse_is_first_non_filter() 2020-02-18 11:55:40 +01:00
trace-events block/block-copy: use block_status 2020-03-11 12:42:30 +01:00
vdi.c block: Add blk_new_with_bs() helper 2020-05-05 13:17:36 +02:00
vhdx-endian.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
vhdx-log.c block: Add flags to bdrv(_co)_truncate() 2020-04-30 17:51:07 +02:00
vhdx.c Block patches: 2020-05-05 16:46:37 +01:00
vhdx.h block/vhdx: Use IEC binary prefixes for size constants 2019-04-30 15:29:00 +02:00
vmdk.c block: Add blk_new_with_bs() helper 2020-05-05 13:17:36 +02:00
vpc.c block: Add blk_new_with_bs() helper 2020-05-05 13:17:36 +02:00
vvfat.c block: Comment cleanups 2020-05-05 13:17:36 +02:00
vxhs.c replay: add BH oneshot event for block layer 2019-10-14 17:12:48 +02:00
win32-aio.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
write-threshold.c qapi: Drop qapi_event_send_FOO()'s Error ** argument 2018-08-28 18:21:38 +02:00