blob: 305f534c18d5b93021b56b79d5258427beaf94dc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
Data corruption with qcow2 images
Steps to reproduce:
```
# Create an example file with old version of qemu-img and fill it with random data.
$ qemu-img-8.2.2 create -f qcow2 file.qcow2 600000000000
$ qemu-nbd-8.2.2 -c /dev/nbd0 file.qcow2
$ dd if=/dev/random of=/dev/nbd0 bs=1000000 count=600000
$ qemu-nbd-8.2.2 -d /dev/nbd0
/dev/nbd0 disconnected
# Get the correct checksum of both qcow2 file and its contents
$ sha256sum -b file.qcow2
ca471f6822af4fcf3c81bc5cc671493be06a837b71b43c1f747042759da587b9 *file.qcow2
$ qemu-nbd-8.2.2 -r -c /dev/nbd0 file.qcow2
$ sha256sum -b /dev/nbd0
5dac11e88f891740da3b655588b2e62037962d1ba6377efce30124d6224dd0d1 */dev/nbd0
$ qemu-nbd-8.2.2 -d /dev/nbd0
/dev/nbd0 disconnected
# Use the qcow2 file with new version.
# We're using qemu-nbd here, but the same happens when qcow2 is attached to a guest
# running in the new version qemu-system-86_64-9.1.1 and can be seen through guest's
# /dev/vda.
# Note that the checksum is different than before, and also non-deterministic
# (running sha256sum twice produces different results even though the file is
# read-only and hasn't changed).
$ sha256sum -b file.qcow2
ca471f6822af4fcf3c81bc5cc671493be06a837b71b43c1f747042759da587b9 *file.qcow2
$ qemu-nbd-9.1.1 -r -c /dev/nbd0 file.qcow2
$ sha256sum -b /dev/nbd0
1793a38b9b964d3fc643629284722373e9d5dedea68e35900ace777b57688926 */dev/nbd0
$ sha256sum -b /dev/nbd0
98f900f9cd174493d0bfcf06e2bc86f5ee99dfa04c90d6832fa941e384b62d49 */dev/nbd0
$ qemu-nbd-9.1.1 -d /dev/nbd0
/dev/nbd0 disconnected
$ sha256sum -b file.qcow2
ca471f6822af4fcf3c81bc5cc671493be06a837b71b43c1f747042759da587b9 *file.qcow2
```
Additional information:
No errors in either host or guest logs. When using a qcow2 with an actual filesystem, you may see reports of corruption from the filesystem driver.
|