On Thu, 5 Nov 2026 at 17:18, Kevin Wolf <[email protected]> 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
