From: Anthony PERARD <anthony.perard@citrix.com>
To: Ian Jackson <ian.jackson@citrix.com>
Cc: xen-devel@lists.xenproject.org, Wei Liu <wei.liu2@citrix.com>,
George Dunlap <george.dunlap@citrix.com>
Subject: Re: [RFC 1/4] libxl: Learned to send FD through QMP to QEMU
Date: Mon, 16 Apr 2018 17:11:29 +0100 [thread overview]
Message-ID: <20180416161129.GJ2208@perard> (raw)
In-Reply-To: <23226.7439.297486.532988@mariner.uk.xensource.com>
On Tue, Mar 27, 2018 at 11:29:35AM +0100, Ian Jackson wrote:
> (George, CC'ing you wrt your depriv doc patch - see below.)
>
> Anthony PERARD writes ("[RFC 1/4] libxl: Learned to send FD through QMP to QEMU"):
> > + /* File descriptor to send to QEMU on the next command */
> > + int fd_to_send;
>
> I did wonder if this was a layering violation, or a poor API in some
> other sense. AFAICT it isn't, and libxl__qmp_handler is completely
> transparent to everything in libxl_qmp.c.
>
> I think this whole file would benefit from some doc comments about the
> internal interfaces. Particularly, something describing the boundary
> between operation-specific code and the generic qmp_send machinery
> would help review of both (i) new operations and (ii) extensions of
> the generic machinery.
I'll try to write some documentation.
> Looking at this and the next patch, I think (almost?) every user of
> this new feature will need to tell qmp_send to call
> qmp_fdset_add_fd_callback. Is that right ? Maybe this means we want
> to provide a more cooked version.
Not exactly. We can add a parameter to "add-fd" to use a specific
"fdset-id".
> Anthony PERARD writes ("[RFC 2/4] libxl: Have QEMU save its state to a file descriptor"):
> > In case QEMU have restricted access to the system, open the file for it,
> > and QEMU will save its state to this file descritor.
>
> This 2nd patch looks reasonable, but it prompted to notice two new
> kinds of hazard introduced by the deprivileging design goal:
>
> > int libxl__qmp_save(libxl__gc *gc, int domid, const char *filename, bool live)
> > {
> ...
> > + rc = qmp_synchronous_send(qmp, "add-fd", NULL,
> > + qmp_fdset_add_fd_callback, &new_fdset,
> > + qmp->timeout);
> > + if (rc)
> > + goto out;
>
> By this point, a depriv'd qemu must be assumed to be compromised by
> its guest - ie we must treat it as hostile.
>
> This is not consistent with use of qmp_synchronous_send, because
> qmp_synchronous_send will block with both the domain and ctx locks
> held. That is, a malicious qemu can deny service; it even has the
> ability to prevent its serviced domain from being destroyed.
>
> Secondly, the point about qemu now being malicious means that we need
> to audit the code which handles communications with qemu for safety.
>
> I think this means that:
>
> * George's todo list patch for the depriv doc should mention
> the need to replace qmp_synchronous_send with qemp_send.
>
> * Likewise it should mention the need for this audit.
>
> * We should write a comment somewhere (near the top of libxl_qmp.c
> perhaps) warning developers not to treat qemu as trusted. That
> would usefully fit into your own series.
>
> I volunteer to do the audit. Some internal commentary about the
> internal interfaces (as I discuss above) would be helpful for that.
I think we would need to rewrite part of libxl_qmp.c to use the
libxl__ev_*, so QEMU would not be able to block libxl.
--
Anthony PERARD
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-04-16 16:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-26 18:33 [RFC 0/4] libxl: Enable save/restore/migration of a restricted QEMU Anthony PERARD
2018-03-26 18:33 ` [RFC 1/4] libxl: Learned to send FD through QMP to QEMU Anthony PERARD
2018-03-27 10:29 ` Ian Jackson
2018-03-27 10:58 ` George Dunlap
2018-03-27 11:49 ` Anthony PERARD
2018-04-16 16:11 ` Anthony PERARD [this message]
2018-03-26 18:33 ` [RFC 2/4] libxl: Have QEMU save its state to a file descriptor Anthony PERARD
2018-03-26 18:34 ` [RFC 3/4] libxl_qmp: Implement query-status command Anthony PERARD
2018-03-26 18:34 ` [RFC 4/4] HACK libxl_exec: Check QEMU status via QMP instead of xenstore Anthony PERARD
2018-03-27 10:36 ` Ian Jackson
2018-03-27 11:13 ` Anthony PERARD
2018-03-27 13:43 ` Ian Jackson
2018-03-27 14:20 ` Anthony PERARD
2018-03-27 14:48 ` Ian Jackson
2018-03-27 17:58 ` Anthony PERARD
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=20180416161129.GJ2208@perard \
--to=anthony.perard@citrix.com \
--cc=george.dunlap@citrix.com \
--cc=ian.jackson@citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.