qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] The unholy encrypted image key mess
Date: Wed, 5 Mar 2014 11:16:45 +0100	[thread overview]
Message-ID: <20140305101645.GA4483@dhcp-200-207.str.redhat.com> (raw)
In-Reply-To: <871tyh9i43.fsf@blackfin.pond.sub.org>

Am 05.03.2014 um 09:15 hat Markus Armbruster geschrieben:
> Eric Blake <eblake@redhat.com> writes:
> > Uggh - so there's no current way to hot-plug a device in state GOTKEY
> > short of using a two-command sequence?  It would be nicer if hot-plug
> > had a way to fail to add encrypted devices unless the user also passes
> > the password at the same time, creating the device directly into the
> > GOTKEY state.
> 
> I can't see why QMP commands would ever want to create in state NEEDKEY.
> We could easily avoid it there: give QMP commands creating
> BlockDriverStates an optional password parameter, fail the command if
> the BDS is encrypted and the password parameter is missing.

Yes.

> For HMP, we need to make up our minds how to do passwords.
> 
> The current way is to tie NEEDKEY to "guest paused".  I hate that.
> 
> Another way is to make the commands adding BDS prompt for necessary
> passwords.  We still have to deal with state NEEDKEY while we're waiting
> for the user's reply.  Need to take care to hide the new BDS.  Create it
> anonymous, and publish it only after setting the key?

HMP is just a QMP user, so if QMP never creates images in a NEEDKEY
state, HMP doesn't either. And that's fine: Let QMP return an error
("this needs a password and you didn't specify one") and then ask the
user for a password and retry.

Solves the whole problem with the NEEDKEY state by eliminating it. I'm
not entirely sure if NEEDKEY is the only state of not fully initialised
BDSes, but perhaps it really is.

> We'd have to do the same for the command line, of course.

This one could become a bit trickier because you'd have to ask for the
password not only before you let the VM run, but even before you create
the virtual disk devices.

> Incompatible change, but since this stuff doesn't really work and really
> shouldn't be used...

I'm not even sure if it is incompatible on the external interface. HMP
would be similar enough, and QMP already returns errors for encrypted
disks in qmp_change_blockdev() and has no pre-2.0 interface for
hotplugging disks.

Oh right, that error is a non-error and the block device is created
anyway. This is stupid, we'd have to make an incompatible change to
change this into a real error.

We also need to make sure that blockdev-add fails on encrypted images if
no password is given, this may still be missing.

Kevin

  parent reply	other threads:[~2014-03-05 10:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-28 21:01 [Qemu-devel] The unholy encrypted image key mess Markus Armbruster
2014-02-28 22:08 ` Eric Blake
2014-03-01 14:44   ` Paolo Bonzini
2014-03-05  8:24     ` Markus Armbruster
2014-03-05  9:01       ` Paolo Bonzini
2014-03-05  9:49         ` Markus Armbruster
2014-03-05  8:15   ` Markus Armbruster
2014-03-05  9:29     ` Gerd Hoffmann
2014-03-05 10:16     ` Kevin Wolf [this message]
2014-03-05 12:45       ` Markus Armbruster
2014-03-03 10:58 ` Kevin Wolf
2014-03-05  8:43   ` Markus Armbruster
2014-03-05  9:17     ` Paolo Bonzini
2014-03-05  9:33     ` Andreas Färber
2014-03-05 10:36       ` Markus Armbruster
2014-03-05 10:40         ` Paolo Bonzini
2014-03-05 12:50           ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140305101645.GA4483@dhcp-200-207.str.redhat.com \
    --to=kwolf@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).