qemu-cr16/tests
Alberto Garcia 909852ba6b qemu-img rebase: don't exceed IO_BUF_SIZE in one operation
During a rebase operation data is copied from the backing chain into
the target image using a loop, and each iteration looks for a
contiguous region of allocated data of at most IO_BUF_SIZE (2 MB).

Once that region is found, and in order to avoid partial writes, its
boundaries are extended so they are aligned to the (sub)clusters of
the target image (see commit 12df580b).

This operation can however result in a region that exceeds the maximum
allowed IO_BUF_SIZE, crashing qemu-img.

This can be easily reproduced when the source image has a smaller
cluster size than the target image:

base <- int <- active

$ qemu-img create -f qcow2 base.qcow2 4M
$ qemu-img create -f qcow2 -F qcow2 -b base.qcow2 -o cluster_size=1M int.qcow2
$ qemu-img create -f qcow2 -F qcow2 -b int.qcow2  -o cluster_size=2M active.qcow2
$ qemu-io -c "write -P 0xff 1M 2M" int.qcow2
$ qemu-img rebase -F qcow2 -b base.qcow2 active.qcow2
qemu-img: qemu-img.c:4102: img_rebase: Assertion `written + pnum <= IO_BUF_SIZE' failed.
Aborted

Cc: qemu-stable <qemu-stable@nongnu.org>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3174
Fixes: 12df580b3b ("qemu-img: rebase: avoid unnecessary COW operations")
Signed-off-by: Alberto Garcia <berto@igalia.com>
Message-ID: <20251107091834.383781-1-berto@igalia.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-11-11 22:06:09 +01:00
..
bench tests/bench: Rename test_akcipher_keys.inc -> test_akcipher_keys.c.inc 2024-09-20 10:08:24 +03:00
data tests/qtest/bios-tables-test: Update DSDT blobs after GPEX _DSM change 2025-11-09 08:24:29 -05:00
decode decodetree: Infer argument set before inferring format 2025-07-25 10:31:45 +01:00
docker rust: add back to Ubuntu 22.04 jobs 2025-11-04 17:13:25 +01:00
fp fpu: allow flushing of output denormals to be after rounding 2025-02-11 16:22:07 +00:00
functional tests/functional: Mark another MIPS replay test as flaky 2025-11-10 11:58:19 +01:00
guest-debug tests, scripts: Don't import print_function from __future__ 2025-09-16 17:31:53 +01:00
image-fuzzer
include meson: fix Windows build 2025-06-16 13:16:27 -04:00
keys
lcitool rust: add back to Ubuntu 22.04 jobs 2025-11-04 17:13:25 +01:00
migration-stress guestperf: Add test result data into report 2025-02-14 15:19:07 -03:00
multiboot
perf/block/qcow2
qapi-schema qapi: Add documentation format validation 2025-11-04 13:55:27 +01:00
qemu-iotests qemu-img rebase: don't exceed IO_BUF_SIZE in one operation 2025-11-11 22:06:09 +01:00
qtest tests/qtest/bios-tables-test: Update DSDT blobs after GPEX _DSM change 2025-11-09 08:24:29 -05:00
rocker
tcg tests/tcg/s390x: Test SET CLOCK COMPARATOR 2025-11-03 08:27:59 +01:00
tracetool tracetool/syslog: add Rust support 2025-10-01 11:22:07 -04:00
tsan system/physmem: Drop 'cpu_' prefix in Physical Memory API 2025-10-07 05:03:56 +02:00
uefi-test-tools uefi-test-tools:: Add LoongArch64 support 2025-06-01 06:38:53 -04:00
unit aio-posix: integrate fdmon into glib event loop 2025-11-11 22:04:53 +01:00
vm tests/freebsd: enable Rust 2025-09-30 19:33:25 +04:00
dbus-vmstate-daemon.sh
Makefile.include tests: Evict stale files in the functional download cache after a while 2025-10-16 17:44:32 +02:00
meson.build tracetool: add test suite for tracetool with reference output 2025-09-16 13:31:40 -04:00
test-qht-par.c
vhost-user-bridge.c