Skip to content

vmdk: Fix possible segfault with non-VMDK backing

Max Reitz qemu-devel 1 version Applied

Status from this message: Applied to my block branch.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 2 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/2vmdk: Fix possible segfault with non-VMDK backingblock/vmdk.c+6 -01 reply
2/2iotests: Add VMDK backing file correlation testtests/qemu-iotests/225 tests/qemu-iotests/225.out tests/qemu-iotests/group+157 -00 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchFam Zheng
1/2R-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [Qemu-devel] [PATCH 0/2] vmdk: Fix possible segfault with non-VMDK backing

The VMDK driver assumes that its backing file is always a VMDK file, too, because it verifies that when creating the overlay. However, that verification means nothing at runtime, and consequently you can assign non-VMDK backing files to a VMDK node. This then breaks because the driver accesses the backing node as a VMDK node to read its supposed CID to compare it with the overlay's parentCID entry -- which usually fails, either in a benign way (we read from a garbage offset, and then we read garbage or get a read error straight away), or we get a segfault (because the backing node does not have a respective file child).

Anyway, we just shouldn't do it and instead check whether the backing file is a VMDK node before treating it like one.

(This fixes
http://lists.nongnu.org/archive/html/qemu-block/2018-06/msg01268.html)

Max Reitz (2):
vmdk: Fix possible segfault with non-VMDK backing
iotests: Add VMDK backing file correlation test

 block/vmdk.c               |   6 ++
 tests/qemu-iotests/225     | 132 +++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/225.out |  24 +++++++
 tests/qemu-iotests/group   |   1 +
 4 files changed, 163 insertions(+)
 create mode 100755 tests/qemu-iotests/225
 create mode 100644 tests/qemu-iotests/225.out
Signature · 1 line
2.17.1