[libvirt] [PATCH] util: storage: drop VIR_STORAGE_FILE_AUTO_SAFE

Peter Krempa pkrempa at redhat.com
Mon Aug 26 07:11:20 UTC 2019


On Mon, Aug 26, 2019 at 11:59:06 +0800, Yi Li wrote:
> merge VIR_STORAGE_FILE_AUTO_SAFE/VIR_STORAGE_FILE_AUTO to VIR_STORAGE_FILE_AUTO
> virStorageFileProbeFormatFromBuf will probe the backingStore format.
> 
> Fix the booting issue when setting backingStore format (QCOW image) to RAW image.

This description does not really describe what the problem is.

> 
> Signed-off-by: Yi Li <yili at winhong.com>
> ---
>  src/qemu/qemu_block.c     | 2 --
>  src/util/virstoragefile.c | 4 +---
>  src/util/virstoragefile.h | 1 -
>  3 files changed, 1 insertion(+), 6 deletions(-)
> 
> @@ -4916,8 +4916,6 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
>              goto cleanup;
>  
>          if (backingFormat == VIR_STORAGE_FILE_AUTO)
> -            backingStore->format = VIR_STORAGE_FILE_RAW;
> -        else if (backingFormat == VIR_STORAGE_FILE_AUTO_SAFE)
>              backingStore->format = VIR_STORAGE_FILE_AUTO;

I don't think we can do this safely. This code was added so that we
never let qemu probe the image format. This was due to a security issue
as a malicious guest could write a qcow2 or any other storage format
header which has backing files into a raw volume. At new start this
would be detected as the qcow2 or other format and qemu would open also
the backing file. The guest then would gain access to un-allowed
resources.

While now qemu refuses writing some parts of the raw image if no format
was specified I don't think we should remove this code. Users always
shall use the correct format.

NACK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190826/c5825138/attachment-0001.sig>


More information about the libvir-list mailing list