From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:58294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qjamq-0002S7-TB for qemu-devel@nongnu.org; Wed, 20 Jul 2011 13:42:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qjamk-0008TY-UU for qemu-devel@nongnu.org; Wed, 20 Jul 2011 13:42:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29611) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qjamk-0008TB-BO for qemu-devel@nongnu.org; Wed, 20 Jul 2011 13:42:14 -0400 Message-ID: <4E271363.6080001@redhat.com> Date: Wed, 20 Jul 2011 11:41:55 -0600 From: Eric Blake MIME-Version: 1.0 References: <4E2055AE.8090107@redhat.com> <4E253136.4080509@redhat.com> <4E258635.2040108@redhat.com> <4E258D70.6000205@redhat.com> <4E25902D.2000403@redhat.com> <4E2593B0.1030508@redhat.com> <4E2594FB.4050203@redhat.com> <4E25AD51.4000802@codemonkey.ws> <4E269101.8030904@redhat.com> <4E26A767.8090101@redhat.com> <4E26D735.7050507@redhat.com> <4E26DD5B.9010703@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] live snapshot wiki updated List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: Kevin Wolf , Stefan Hajnoczi , "libvir-list@redhat.com" , Jes Sorensen , QEMU Developers , Stefan Hajnoczi On 07/20/2011 11:20 AM, Blue Swirl wrote: > There could still be some issues: > Let's have files A, B, C etc. with backing files AA etc. How would > libvirt know that when QEMU wants to write to file CA, this is because > it's needed to access C, or is it just trickery by a devious guest to > corrupt storage? The fix for CVE-2010-2238 already deals with this: if primary image C refers to backing file CA of raw format, but does not state what file format CA contains, then a malicious guest can modify the contents of CA to appear to be yet another qcow2 image. At which point, if libvirt follows the backing file specified in CA, then yes, the malicious guest really can cause libvirt to expose arbitrary file CB for manipulation by the guest. But that security hole was already plugged - by default, libvirt refuses to probe backing files parsed from qcow2 headers for file format, but instead requires the outer qcow2 header to also include the a file format designation for the backing file. At which point, you then have a safe chain: if C refers to CA, then libvirt knows that both C and CA are essential to the storage presented by giving qemu the file name C, and the guest will already be modifying CA, but there is no storage corruption involved. That is, as long as libvirt can already accurately read the chain of backing files from any starting point, then it can hand that entire chain of backing files (whether by the topmost file name as it does now, or whether by a series of fds as is being proposed) to qemu. > > This could be handled so that instead of naming the backing file, QEMU > asks for a descriptor for the backing file by presenting the > descriptor to main file C, but I think the real solution is that > libvirt should handle the storage formats completely and it should > present QEMU with only a raw file like interface (read/write/seek) for > the data. Then any backing files would be handled within libvirt. > Performance could suffer, though. The monitor interface was not designed to throw the read()/write()/seek() burden back on libvirt, and indeed that would kill performance so it is a non-starter idea. All we need for security is the open() burden to be shifted out of qemu and into libvirt. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org