qemu/tests
Max Reitz a1406a9262 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>
2019-10-14 17:12:48 +02:00
..
acceptance Acceptance tests: use avocado.utils.ssh for SSH interaction 2019-09-20 17:13:41 -04:00
data pc: Add an SMB0 ACPI device to q35 2019-09-20 14:09:24 -05:00
decode decodetree: Allow !function with no input bits 2019-08-19 08:03:41 -07:00
docker tests/docker: only enable ubsan for test-clang 2019-10-04 18:49:19 +02:00
fp softfloat: Support float_round_to_odd more places 2019-02-26 14:08:03 +00:00
guest-debug
image-fuzzer
keys
libqos tests/libqos: Replace clock_step with qtest_clock_step in virtio code 2019-09-05 13:18:52 +02:00
migration Replace '-machine accel=xyz' with '-accel xyz' 2019-09-19 12:01:48 +02:00
multiboot tests/multiboot: Fix load address of test kernels 2019-07-30 12:25:43 +02:00
perf/block/qcow2 tests/perf: Test lseek influence on qcow2 block-status 2019-06-04 15:20:41 +02:00
qapi-schema qapi: Improve source file read error handling 2019-09-28 17:17:48 +02:00
qemu-iotests iotests: Test large write request to qcow2 file 2019-10-14 17:12:48 +02:00
rocker
tcg target-arm queue: 2019-09-30 11:02:22 +01:00
uefi-test-tools edk2 build scripts: work around TianoCore#1607 without forcing Python 2 2019-10-07 15:14:15 +02:00
vm Fedora images: use URLs from stable "archives.fedoraproject.org" 2019-09-10 14:14:32 +01:00
vmstate-static-checker-data
.gitignore tests/.gitignore: ignore test-qapi-emit-events.[ch] for in-tree builds 2019-03-14 16:02:13 +01:00
ac97-test.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
acpi-utils.c tests: acpi: add acpi_find_rsdp_address_uefi() helper 2019-05-20 18:40:02 -04:00
acpi-utils.h tests: acpi: add acpi_find_rsdp_address_uefi() helper 2019-05-20 18:40:02 -04:00
ahci-test.c tests: Remove unnecessary global_qtest references 2019-09-05 13:18:52 +02:00
atomic64-bench.c tests: use g_usleep instead of rem = sleep(time) 2019-01-14 14:52:30 +00:00
atomic_add-bench.c tests: use g_usleep instead of rem = sleep(time) 2019-01-14 14:52:30 +00:00
benchmark-crypto-cipher.c
benchmark-crypto-hash.c
benchmark-crypto-hmac.c
bios-tables-test-allowed-diff.h q35: update DSDT 2019-06-16 16:44:44 -04:00
bios-tables-test.c tests: Remove unnecessary global_qtest references 2019-09-05 13:18:52 +02:00
boot-order-test.c tests/boot-order: Make test independent of global_qtest 2019-01-22 05:14:32 +01:00
boot-sector.c
boot-sector.h
boot-serial-test.c m68k: Add serial controller to the NeXTcube machine 2019-09-07 08:32:34 +02:00
cdrom-test.c Disallow colons in the parameter of "-accel" 2019-10-01 11:54:17 +02:00
check-block-qdict.c
check-block.sh tests/check-block: Skip iotests when sanitizers are enabled 2019-09-03 14:56:06 +02:00
check-qdict.c tests: Move qdict-test-data.txt to tests/data/qobject/ 2019-03-07 22:05:54 +01:00
check-qjson.c test: Use g_strndup instead of plain strndup 2019-08-21 10:27:13 +02:00
check-qlist.c
check-qlit.c
check-qnull.c
check-qnum.c
check-qobject.c
check-qom-interface.c qom: make interface types abstract 2018-12-11 15:45:22 -02:00
check-qom-proplist.c
check-qstring.c
cpu-plug-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
crypto-tls-psk-helpers.c
crypto-tls-psk-helpers.h Supply missing header guards 2019-06-12 13:20:21 +02:00
crypto-tls-x509-helpers.c
crypto-tls-x509-helpers.h Supply missing header guards 2019-06-12 13:20:21 +02:00
device-introspect-test.c tests/device-introspect: Use qtest_init() instead of qtest_start() 2019-05-21 10:00:41 +02:00
device-plug-test.c tests/device-plug: Add PHB unplug request test for spapr 2019-02-26 09:21:25 +11:00
display-vga-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
drive_del-test.c tests: Set read-zeroes on for null-co driver 2019-08-15 19:23:59 +02:00
ds1338-test.c libqos: i2c: move address into QI2CDevice 2019-06-03 14:03:02 +02:00
e1000-test.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
e1000e-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
eepro100-test.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
endianness-test.c tests/endianesss: Make test independent of global_qtest 2019-01-22 05:14:32 +01:00
es1370-test.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
fdc-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
fw_cfg-test.c tests: fw_cfg: add 'splash-time' test case 2019-05-23 14:10:31 +02:00
hd-geo-test.c tests/hd-geo-test: Use qtest_init() instead of qtest_start() 2019-05-21 10:00:46 +02:00
hexloader-test.c tests/hexloader-test: Don't pass -nographic to the QEMU under test 2019-01-22 06:26:32 +01:00
i440fx-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
i82801b11-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
ide-test.c tests/ide-test: Make test independent of global_qtest 2019-05-08 16:59:28 +02:00
intel-hda-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
io-channel-helpers.c
io-channel-helpers.h Normalize position of header guard 2019-06-12 13:20:20 +02:00
ioh3420-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
iothread.c
iothread.h
ipmi-bt-test.c tests:ipmi: Fix IPMI BT tests 2019-09-20 14:08:10 -05:00
ipmi-kcs-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
ipoctal232-test.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
ivshmem-test.c tests: Remove unnecessary global_qtest references 2019-09-05 13:18:52 +02:00
libqtest-single.h tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
libqtest.c Replace '-machine accel=xyz' with '-accel xyz' 2019-09-19 12:01:48 +02:00
libqtest.h tests/libqtest: Allow setting expected exit status 2019-09-12 11:19:48 +01:00
m25p80-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
m48t59-test.c tests: Do not use "\n" in g_test_message() strings 2019-03-07 22:16:22 +01:00
machine-none-test.c tests/machine-none: Test recent MIPS cpus 2019-07-02 14:17:15 +02:00
Makefile.include tests: fix echi/ehci typo 2019-10-01 11:42:27 +02:00
megasas-test.c tests: Set read-zeroes on for null-co driver 2019-08-15 19:23:59 +02:00
microbit-test.c tests/microbit-test: Add tests for nRF51 NVMC 2019-02-01 15:32:17 +00:00
migration-test.c tests/migration: Add a test for auto converge 2019-10-03 12:48:42 +02:00
modules-test.c tests: fix modules-test with no default machine 2019-09-02 10:52:22 +01:00
ne2000-test.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
numa-test.c tests/numa-test: Use qtest_init() instead of qtest_start() 2019-05-21 10:00:32 +02:00
nvme-test.c tests: Set read-zeroes on for null-co driver 2019-08-15 19:23:59 +02:00
pca9552-test.c libqos: i2c: move address into QI2CDevice 2019-06-03 14:03:02 +02:00
pci-test.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
pcnet-test.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
pflash-cfi02-test.c hw/block/pflash_cfi02: Implement erase suspend/resume 2019-07-02 02:34:55 +02:00
pkix_asn1_tab.c
pnv-xscom-test.c ppc/pnv: Introduce PowerNV machines with fixed CPU models 2019-08-29 09:45:53 +10:00
prom-env-test.c Suppress test warnings about missing Spectre/Meltdown mitigations with TCG 2019-03-12 16:07:14 +11:00
ptimer-test-stubs.c util/qemu-timer: refactor deadline calculation for external timers 2019-08-20 17:26:21 +02:00
ptimer-test.c util/qemu-timer: refactor deadline calculation for external timers 2019-08-20 17:26:21 +02:00
ptimer-test.h
pvpanic-test.c tests/pvpanic: Make the pvpanic test independent of global_qtest 2018-12-17 15:36:40 +01:00
pxe-test.c Suppress test warnings about missing Spectre/Meltdown mitigations with TCG 2019-03-12 16:07:14 +11:00
q35-test.c tests/q35-test: Make test independent of global_qtest 2019-05-21 10:00:27 +02:00
qht-bench.c tests: use g_usleep instead of rem = sleep(time) 2019-01-14 14:52:30 +00:00
qmp-cmd-test.c tests/qmp-cmd-test: Use qtest_init() instead of qtest_start() 2019-05-08 16:59:28 +02:00
qmp-test.c tests: Set read-zeroes on for null-co driver 2019-08-15 19:23:59 +02:00
qom-test.c tests/qom-test: Use qtest_init() instead of qtest_start() 2019-05-21 10:00:37 +02:00
qos-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
rcutorture.c
requirements.txt Acceptance tests: use avocado.utils.ssh for SSH interaction 2019-09-20 17:13:41 -04:00
rtas-test.c tests: Remove unnecessary global_qtest references 2019-09-05 13:18:52 +02:00
rtc-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
rtl8139-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
sdhci-test.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
socket-helpers.c tests: specify the address family when checking bind 2019-08-22 17:30:25 +04:00
socket-helpers.h tests: specify the address family when checking bind 2019-08-22 17:30:25 +04:00
spapr-phb-test.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
tco-test.c tests/tco: Make test independent of global_qtest 2019-05-08 16:59:28 +02:00
test-aio-multithread.c tests: Do not use "\n" in g_test_message() strings 2019-03-07 22:16:22 +01:00
test-aio.c
test-arm-mptimer.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
test-authz-list.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
test-authz-listfile.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
test-authz-pam.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
test-authz-simple.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
test-base64.c
test-bdrv-drain.c job: drop job_drain 2019-09-10 08:58:43 +02:00
test-bdrv-graph-mod.c Include qemu/main-loop.h less 2019-08-16 13:31:52 +02:00
test-bitcnt.c
test-bitmap.c test-bitmap: test set 1 bit case for bitmap_set 2019-08-20 20:00:51 +02:00
test-bitops.c
test-block-backend.c Include qemu/main-loop.h less 2019-08-16 13:31:52 +02:00
test-block-iothread.c job: drop job_drain 2019-09-10 08:58:43 +02:00
test-blockjob-txn.c job: drop job_drain 2019-09-10 08:58:43 +02:00
test-blockjob.c job: drop job_drain 2019-09-10 08:58:43 +02:00
test-bufferiszero.c
test-char.c tests: skip serial test on windows 2019-10-04 18:49:18 +02:00
test-clone-visitor.c tests: Rename UserDefNativeListUnion to UserDefListUnion 2019-03-05 14:43:11 +01:00
test-coroutine.c tests: Do not use "\n" in g_test_message() strings 2019-03-07 22:16:22 +01:00
test-crypto-afsplit.c
test-crypto-block.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
test-crypto-cipher.c
test-crypto-hash.c
test-crypto-hmac.c
test-crypto-ivgen.c
test-crypto-pbkdf.c test: execute g_test_run when tests are skipped 2019-01-11 13:57:25 +01:00
test-crypto-secret.c
test-crypto-tlscredsx509.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
test-crypto-tlssession.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
test-crypto-xts.c
test-cutils.c cutils: Fix qemu_strtosz() & friends to reject non-finite sizes 2018-12-13 19:10:06 +01:00
test-filter-mirror.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
test-filter-redirector.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
test-hbitmap.c tests/test-hbitmap: test next_zero and _next_dirty_area after truncate 2019-08-16 18:29:43 -04:00
test-hmp.c tests/test-hmp: Use qtest_init() instead of qtest_start() 2019-05-08 16:59:28 +02:00
test-image-locking.c Include qemu/main-loop.h less 2019-08-16 13:31:52 +02:00
test-int128.c
test-io-channel-buffer.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
test-io-channel-command.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
test-io-channel-file.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
test-io-channel-socket.c socket: Add num connections to qio_channel_socket_async() 2019-09-03 23:24:42 +02:00
test-io-channel-tls.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
test-io-task.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
test-iov.c
test-keyval.c
test-logging.c
test-mul64.c
test-netfilter.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
test-opts-visitor.c
test-qapi-util.c
test-qdev-global-props.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
test-qdist.c
test-qemu-opts.c
test-qga.c qmp-dispatch: Use CommandNotFound error for disabled commands 2019-09-28 16:51:30 +02:00
test-qgraph.c tests: test-qgraph: fix a memory leak 2019-03-11 16:33:49 +01:00
test-qht-par.c
test-qht.c
test-qmp-cmds.c qapi: Permit 'boxed' with empty type 2019-09-24 14:07:22 +02:00
test-qmp-event.c qapi: Generate QAPIEvent stuff into separate files 2019-02-18 14:44:04 +01:00
test-qobject-input-visitor.c tests: Rename UserDefNativeListUnion to UserDefListUnion 2019-03-05 14:43:11 +01:00
test-qobject-output-visitor.c tests: Rename UserDefNativeListUnion to UserDefListUnion 2019-03-05 14:43:11 +01:00
test-rcu-list.c qemu/queue.h: leave head structs anonymous unless necessary 2019-01-11 15:46:55 +01:00
test-rcu-simpleq.c
test-rcu-tailq.c
test-replication.c Include qemu/main-loop.h less 2019-08-16 13:31:52 +02:00
test-shift128.c
test-string-input-visitor.c tests: Fix uninitialized byte in test_visitor_in_fuzz 2019-08-20 17:26:19 +02:00
test-string-output-visitor.c
test-thread-pool.c test-thread-pool: be more reliable 2019-06-03 14:03:00 +02:00
test-throttle.c test-throttle: Fix uninitialized use of burst_length 2019-08-20 17:26:19 +02:00
test-timed-average.c
test-util-filemonitor.c tests: make filemonitor test more robust to event ordering 2019-09-11 10:29:27 +01:00
test-util-sockets.c socket: Add backlog parameter to socket_listen 2019-09-03 23:24:42 +02:00
test-uuid.c
test-visitor-serialization.c
test-vmstate.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
test-write-threshold.c
test-x86-cpuid-compat.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
test-x86-cpuid.c i386: Update new x86_apicid parsing rules with die_offset support 2019-07-05 17:08:03 -03:00
test-xbzrle.c
tmp105-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
tpm-crb-swtpm-test.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
tpm-crb-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
tpm-emu.c socket: Add num connections to qio_channel_socket_sync() 2019-09-03 23:24:42 +02:00
tpm-emu.h Clean up decorations and whitespace around header guards 2019-05-13 08:58:55 +02:00
tpm-tests.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
tpm-tests.h
tpm-tis-swtpm-test.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
tpm-tis-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
tpm-util.c
tpm-util.h Clean up includes 2018-12-20 10:29:08 +01:00
usb-hcd-ehci-test.c tests: fix usb-hcd-ehci-test compilation 2019-10-01 11:42:27 +02:00
usb-hcd-ohci-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
usb-hcd-uhci-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
usb-hcd-xhci-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
vhost-user-bridge.c libvhost-user: support many virtqueues 2019-07-04 17:00:32 -04:00
vhost-user-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
virtio-9p-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
virtio-blk-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
virtio-ccw-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
virtio-net-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
virtio-rng-test.c tests/libqtest: Make qtest_qmp_device_add/del independent from global_qtest 2019-08-15 19:24:10 +02:00
virtio-scsi-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
virtio-serial-test.c tests/libqtest: Use libqtest-single.h in tests that require global_qtest 2019-09-05 13:18:52 +02:00
virtio-test.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
vmgenid-test.c tests: acpi: make acpi_fetch_table() take size of fetched table pointer 2019-05-20 18:40:02 -04:00
vmxnet3-test.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
wdt_ib700-test.c