block/vmdk.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
This set of patches fixes four reported bugs in vmdk's handling of
potentially malicious image files:
#3843: if cluster_sectors is 0x200000 we can overflow an 'int' and try
to g_malloc() 0xffffffff80000000
#4017: if cluster_sectors is 0 we will divide by zero and SIGFPE
#4029: we can overflow a 32*64 multiply; we catch it a bit later on
so there are no ill-effects, but for robustness it's better to
check before the multiply
#4571: we can read off the end of a block of memory when trying to
parse descriptors; worst case is that we read some junk from
the heap into BlockDriverState::auto_backing_file and
::backing_file. I don't think this is an exploitable info
leak into the guest.
#4571: if the input file specifies no extents, we hit an assert
in vmdk_co_get_info() rather than rejecting the file
(mentioned in passing in the same issue as previous bug)
I think these all classify as "hardening bugs" rather than security
issues, since they're just "self-denial-of-service" at worst.
Tested using qemu-iotests on the vmdk format.
thanks
-- PMM
Peter Maydell (5):
block/vmdk: Avoid assertion if image file has no extents
block/vmdk: Avoid reading off the end of descriptor memory
block/vmdk: Use larger types for byte counts in vmdk_read_extent()
block/vmdk: Reject a zero cluster_sectors parameter
block/vmdk: Avoid overflowing multiplication in vmdk_open_vmdk4()
block/vmdk.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
--
2.43.0
Am 03.11.2026 um 15:35 hat Peter Maydell geschrieben: > This set of patches fixes four reported bugs in vmdk's handling of > potentially malicious image files: > > #3843: if cluster_sectors is 0x200000 we can overflow an 'int' and try > to g_malloc() 0xffffffff80000000 > #4017: if cluster_sectors is 0 we will divide by zero and SIGFPE > #4029: we can overflow a 32*64 multiply; we catch it a bit later on > so there are no ill-effects, but for robustness it's better to > check before the multiply > #4571: we can read off the end of a block of memory when trying to > parse descriptors; worst case is that we read some junk from > the heap into BlockDriverState::auto_backing_file and > ::backing_file. I don't think this is an exploitable info > leak into the guest. > #4571: if the input file specifies no extents, we hit an assert > in vmdk_co_get_info() rather than rejecting the file > (mentioned in passing in the same issue as previous bug) > > I think these all classify as "hardening bugs" rather than security > issues, since they're just "self-denial-of-service" at worst. > > Tested using qemu-iotests on the vmdk format. Thanks, applied to the block branch. It would have been nice to add new qemu-iotests cases that can catch these bugs, maybe you still want to do that on top? And just looking briefly at each of the places that are patched, it's immediately clear to me that some more fixes are needed. :-) Kevin
On Thu, 5 Nov 2026 at 17:18, Kevin Wolf <kwolf@redhat.com> wrote: > > Am 03.11.2026 um 15:35 hat Peter Maydell geschrieben: > > This set of patches fixes four reported bugs in vmdk's handling of > > potentially malicious image files: > > > > #3843: if cluster_sectors is 0x200000 we can overflow an 'int' and try > > to g_malloc() 0xffffffff80000000 > > #4017: if cluster_sectors is 0 we will divide by zero and SIGFPE > > #4029: we can overflow a 32*64 multiply; we catch it a bit later on > > so there are no ill-effects, but for robustness it's better to > > check before the multiply > > #4571: we can read off the end of a block of memory when trying to > > parse descriptors; worst case is that we read some junk from > > the heap into BlockDriverState::auto_backing_file and > > ::backing_file. I don't think this is an exploitable info > > leak into the guest. > > #4571: if the input file specifies no extents, we hit an assert > > in vmdk_co_get_info() rather than rejecting the file > > (mentioned in passing in the same issue as previous bug) > > > > I think these all classify as "hardening bugs" rather than security > > issues, since they're just "self-denial-of-service" at worst. > > > > Tested using qemu-iotests on the vmdk format. > > Thanks, applied to the block branch. > > It would have been nice to add new qemu-iotests cases that can catch > these bugs, maybe you still want to do that on top? I had a look at this, but then re-reading the bug reports I kind of lost the will to continue trying to dig through the AI generated report slop to try to extract something resembling a repro case that could be put into the iotests. I'm also generally dubious about the utility of adding regression tests for "we do something wrong on this specific invalid input" because it seems unlikely to me that we reintroduce the same bug again. The one that was reasonably doable was the "no extent lines" bug. diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059 index 49c58ad05c3..79fd4de1e7e 100755 --- a/tests/qemu-iotests/059 +++ b/tests/qemu-iotests/059 @@ -100,6 +100,18 @@ RW 12582912 VMFS "dummy.vmdk" 1 EOF _img_info +echo +echo "=== Testing malformed VMFS with no extent lines ===" +cat >"$TEST_IMG" <<EOF +# Disk DescriptorFile +version=1 +CID=fffffffe +parentCID=ffffffff +createType="vmfs" + +EOF +_img_info + echo echo "=== Testing truncated sparse ===" _make_test_img -o "subformat=monolithicSparse" 100G diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out index 275ee7c7781..56bdc085862 100644 --- a/tests/qemu-iotests/059.out +++ b/tests/qemu-iotests/059.out @@ -2040,6 +2040,9 @@ read 512/512 bytes at offset 1063004405760 === Testing malformed VMFS extent description line === qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Invalid extent line: RW 12582912 VMFS "dummy.IMGFMT" 1 +=== Testing malformed VMFS with no extent lines === +qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Invalid file: no extent lines present + === Testing truncated sparse === Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=107374182400 qemu-img: Could not open 'TEST_DIR/t.IMGFMT': File truncated, expecting at least 13172736 bytes thanks -- PMM
© 2016 - 2026 Red Hat, Inc.