Received: from eggs.gnu.org ([2001:4830:134:3::10]:58190) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmMPZ-0003ai-DK for qemu-devel@nongnu.org; Thu, 06 Nov 2014 07:43:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XmMPT-0001py-86 for qemu-devel@nongnu.org; Thu, 06 Nov 2014 07:43:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43038) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmMPS-0001ps-WD for qemu-devel@nongnu.org; Thu, 06 Nov 2014 07:43:31 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sA6ChTub016286 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 6 Nov 2014 07:43:29 -0500 From: Markus Armbruster References: <87lhnq3iul.fsf@blackfin.pond.sub.org> <5459E210.2020008@redhat.com> <5459F961.8030305@redhat.com> Date: Thu, 06 Nov 2014 13:43:26 +0100 In-Reply-To: <5459F961.8030305@redhat.com> (Eric Blake's message of "Wed, 05 Nov 2014 11:18:09 +0100") Message-ID: <87sihwv6s1.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] Image probing: how it can be insecure, and what we could do about it List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Kevin Wolf , Jeff Cody , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz Eric Blake writes: > On 11/05/2014 09:38 AM, Max Reitz wrote: > >>> Note that specifying just the top image's format is not enough, you also >>> have to specify any backing images' formats. QCOW2 can optionally store >>> the backing image format in the image. The other COW formats can't. >> >> Well, they can, with "json:". *cough* >> >>> Example of insecure usage: -hda bar.vmdk, where bar.vmdk is a VMDK image >>> with a raw backing file. >> >> Yesterday I found out that doesn't seem possible. You apparently can >> only use VMDK with VMDK backing files. Other than that, we only have >> qcow1 and qed as COW formats which should not be used anyway. > > Actually, qed requires the backing format to be recorded (it is > non-optional) and is therefore immune to probing problems of backing > files. That's one thing it got right. If I read the code correctly: QED has a feature bit QED_F_BACKING_FORMAT_NO_PROBE. It is changed when you set the backing file format. Setting format to "raw" sets the flag, anything else (including nothing) clears the flag. The actual non-raw format is not recorded. Creating an image counts as setting the backing file format. If the flag is set, open uses "raw"for the backing file (no probing). If it's unset, open probes, and the probe may yield "raw".