[pve-devel] bug in backup/restore for non-64K aligned disks + host mem leak to backups
Roland Kammerer
roland.kammerer at linbit.com
Wed Jun 17 15:04:27 CEST 2020
Dear Proxmox developers,
I hope it is fine to report this here, otherwise I can repost on
pve-user.
I initially noticed that backup/restore has a bug when the disk size is
not a multiple of 64K for DRBD devices. Due to DRBD meta-data the user
visible size is almost certainly not 64K aligned. But this is not
limited to DRBD and fairly easy to reproduce on plain LVM. Files used to
reproduce can be found here[1].
- create a VG that is 1k aligned as in "vgcreate -s 1k backup
/dev/whatever"
- add it to /etc/pve/storage.cfg
I created the storage via the GUI, there might be an easier CLI way:
- create a VM on the 1k aligned storage with 1 (GB) of space. Everything
else was set to defaults.
- lvextend -L +4k /dev/backup/vm-100-disk-0 # GUI still shows an even
1GB
- extend the disk via the GUI (1 additional GB); now the GUI shows
2097156K
- zcat /tmp/breaksmox.img.gz - | dd of=/dev/backup/vm-100-disk-0 \
;sync;sync;sync
>From that I created a backup (also via the GUI), all defaults except no
compression.
On "vma verify" this fails:
vma verify /tmp/breaksmox.vma
vma: verify failed - got wrong block address - write beyond end
Trace/breakpoint trap
For me every install of an Alpine Linux on such an "unaligned" disk
triggers this bug (I always did a zero out before the install). The
image from [1] is just zero outed at the beginning after the install to
reduce the size. I did not try to minimize that, I just zeroed a bit
less than 2GB of the installed image.
Here some observations where I *think* things go wrong: The interesting
part is here:
xxd -s 301568 /tmp/breaksmox.vma
If you look at this last VMA Extent Header, the block info with number
0x8000 has a mask of 0xe1fe, and garbage data. I don't think there
should be this (random) garbage at the end.
What is also also slightly worrisome is that I had images/backups where
the garbage part of the backup contained data that could not be found in
the image itself, so most likely this also leaks host memory to the
backups.
Failing for non 64K aligned disks was also reported here[2].
Best, rck
[1] https://packages.linbit.com/rck/breaksmox/
[2] https://forum.proxmox.com/threads/how-do-i-restore-a-vm-with-a-non-64k-block-disk.58863/
More information about the pve-devel
mailing list