All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v7 0/6] file descriptor passing using fd sets
@ 2012-08-07 15:58 Corey Bryant
  2012-08-07 15:58 ` [Qemu-devel] [PATCH v7 1/6] qemu-char: Add MSG_CMSG_CLOEXEC flag to recvmsg Corey Bryant
                   ` (6 more replies)
  0 siblings, 7 replies; 29+ messages in thread
From: Corey Bryant @ 2012-08-07 15:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: kwolf, aliguori, stefanha, libvir-list, Corey Bryant,
	lcapitulino, eblake

libvirt's sVirt security driver provides SELinux MAC isolation for
Qemu guest processes and their corresponding image files.  In other
words, sVirt uses SELinux to prevent a QEMU process from opening
files that do not belong to it.

sVirt provides this support by labeling guests and resources with
security labels that are stored in file system extended attributes.
Some file systems, such as NFS, do not support the extended
attribute security namespace, and therefore cannot support sVirt
isolation.

A solution to this problem is to provide fd passing support, where
libvirt opens files and passes file descriptors to QEMU.  This,
along with SELinux policy to prevent QEMU from opening files, can
provide image file isolation for NFS files stored on the same NFS
mount.

This patch series adds the add-fd, remove-fd, and query-fdsets
QMP monitor commands, which allow file descriptors to be passed
via SCM_RIGHTS, and assigned to specified fd sets.  This allows
fd sets to be created per file with fds having, for example,
different access rights.  When QEMU needs to reopen a file with
different access rights, it can search for a matching fd in the
fd set.  Fd sets also allow for easy tracking of fds per file,
helping to prevent fd leaks.

Support is also added to the block layer to allow QEMU to dup an
fd from an fdset when the filename is of the /dev/fdset/nnn format,
where nnn is the fd set ID.

No new SELinux policy is required to prevent open of NFS files
(files with type nfs_t).  The virt_use_nfs boolean type simply
needs to be set to false, and open will be prevented (and dup will
be allowed).  For example:

    # setsebool virt_use_nfs 0
    # getsebool virt_use_nfs
    virt_use_nfs --> off

Corey Bryant (6):
  qemu-char: Add MSG_CMSG_CLOEXEC flag to recvmsg
  qapi: Introduce add-fd, remove-fd, query-fdsets
  monitor: Clean up fd sets on monitor disconnect
  block: Convert open calls to qemu_open
  block: Convert close calls to qemu_close
  block: Enable qemu_open/close to work with fd sets

 block/raw-posix.c |   42 ++++-----
 block/raw-win32.c |    6 +-
 block/vdi.c       |    5 +-
 block/vmdk.c      |   25 +++--
 block/vpc.c       |    4 +-
 block/vvfat.c     |   16 ++--
 cutils.c          |    5 +
 monitor.c         |  273 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 monitor.h         |    5 +
 osdep.c           |  117 +++++++++++++++++++++++
 qapi-schema.json  |  110 +++++++++++++++++++++
 qemu-char.c       |   12 ++-
 qemu-common.h     |    2 +
 qemu-tool.c       |   20 ++++
 qerror.c          |    4 +
 qerror.h          |    3 +
 qmp-commands.hx   |  131 +++++++++++++++++++++++++
 savevm.c          |    4 +-
 18 files changed, 730 insertions(+), 54 deletions(-)

-- 
1.7.10.4

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2012-08-09 13:29 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-07 15:58 [Qemu-devel] [PATCH v7 0/6] file descriptor passing using fd sets Corey Bryant
2012-08-07 15:58 ` [Qemu-devel] [PATCH v7 1/6] qemu-char: Add MSG_CMSG_CLOEXEC flag to recvmsg Corey Bryant
2012-08-07 15:58 ` [Qemu-devel] [PATCH v7 2/6] qapi: Introduce add-fd, remove-fd, query-fdsets Corey Bryant
2012-08-07 16:49   ` Eric Blake
2012-08-07 17:07     ` Corey Bryant
2012-08-07 22:16       ` Eric Blake
2012-08-08 19:07         ` Corey Bryant
2012-08-08 20:48           ` Luiz Capitulino
2012-08-08 20:52             ` Corey Bryant
2012-08-08 21:13               ` Luiz Capitulino
2012-08-08 21:18                 ` Corey Bryant
2012-08-09  0:38                   ` Luiz Capitulino
2012-08-09 10:11     ` Kevin Wolf
2012-08-09 13:27       ` Corey Bryant
2012-08-09  9:04   ` [Qemu-devel] [libvirt] " Stefan Hajnoczi
2012-08-09 13:06     ` Eric Blake
2012-08-09 13:23       ` Corey Bryant
2012-08-07 15:58 ` [Qemu-devel] [PATCH v7 3/6] monitor: Clean up fd sets on monitor disconnect Corey Bryant
2012-08-07 15:58 ` [Qemu-devel] [PATCH v7 4/6] block: Convert open calls to qemu_open Corey Bryant
2012-08-07 15:58 ` [Qemu-devel] [PATCH v7 5/6] block: Convert close calls to qemu_close Corey Bryant
2012-08-07 15:58 ` [Qemu-devel] [PATCH v7 6/6] block: Enable qemu_open/close to work with fd sets Corey Bryant
2012-08-08 13:02   ` Stefan Hajnoczi
2012-08-08 13:54     ` Corey Bryant
2012-08-08 14:47       ` Stefan Hajnoczi
2012-08-08 13:04 ` [Qemu-devel] [PATCH v7 0/6] file descriptor passing using " Stefan Hajnoczi
2012-08-08 14:54   ` Corey Bryant
2012-08-08 15:58     ` Stefan Hajnoczi
2012-08-08 18:51       ` Corey Bryant
2012-08-09  8:57         ` Stefan Hajnoczi

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.