Received: from eggs.gnu.org ([2001:4830:134:3::10]:44149) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WL7QA-0005Ct-8j for qemu-devel@nongnu.org; Wed, 05 Mar 2014 03:43:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WL7Q4-0000Hy-8u for qemu-devel@nongnu.org; Wed, 05 Mar 2014 03:43:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41930) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WL7Q3-0000Hp-Un for qemu-devel@nongnu.org; Wed, 05 Mar 2014 03:43:16 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s258hEeu007382 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 5 Mar 2014 03:43:14 -0500 From: Markus Armbruster References: <87wqgflzno.fsf@blackfin.pond.sub.org> <20140303105837.GD4850@dhcp-200-207.str.redhat.com> Date: Wed, 05 Mar 2014 09:43:11 +0100 In-Reply-To: <20140303105837.GD4850@dhcp-200-207.str.redhat.com> (Kevin Wolf's message of "Mon, 3 Mar 2014 11:58:37 +0100") Message-ID: <87zjl56nog.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] The unholy encrypted image key mess List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org, Stefan Hajnoczi , Gerd Hoffmann Kevin Wolf writes: > Am 28.02.2014 um 22:01 hat Markus Armbruster geschrieben: >> Questions: >> >> 1. Should we protect guests from state NEEDKEY? > > Yes. An image in state NEEDKEY isn't fully initialised, so we should > make sure that it isn't used. Consensus. >> 2. If yes, how? >> >> Pause the guest when something enters state NEEDKEY? I'd hate that. >> >> Fail device_add in state NEEDKEY? Takes care of hot-plug, and >> cold-plug is already protected by cont. > > 'device_add' should refuse to accept a backend that isn't fully > initialised, so yes, I agree. bdrv_attach_dev() could fail then. > 'change' is a bit trickier because it involves several low-level actions > at once, and device_add is not one of them. The problem is that it can run while a device model is attached. > What we probably really need > to do is support a state where no BDS is attached to the device > emulation (a BlockBackend might still be attached, not sure about this > one), but the VM is still running. And then 'change' can detach the BDS, > bring it back to the NEEDKEY state (unrealize in QOM speech?), magic > happens and then we reattach the BDS to the guest device. In a BlockBackend world, the device model attaches to a BlockBackend, and the BlockBackend may have a BDS[*]. No BDS means no media. Removing media takes away the BDS and destroys it. Inserting media creates a new BDS and gives it to the BlockBackend. To avoid visible NEEDKEY, delay the giving until we reach GOTKEY. > We'll also want to protect other parts of qemu from not fully > initialised BDSes, e.g. block jobs or NBD servers shouldn't take such an > BDS as their source. Good point. Shows that the NEEDKEY problems are more pervasive than I thought. What shall we do about them? We can ship yet another release with known open deathtraps around encrypted images, only this time with a warning against it buried in the documentation for people not to read. Or we can do our users a favor and kill support for encrypted images dead (except in qemu-img, of course). Revive when we have encryption that actually works, both in the safety and security sense. Opinions? [*] Actually: root of a BDS tree (or even BDS DAG?)