From: Corey Bryant <coreyb@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, aliguori@us.ibm.com,
Corey Bryant <coreyb@linux.vnet.ibm.com>,
eblake@redhat.com, stefanha@linux.vnet.ibm.com
Subject: [Qemu-devel] [PATCH 0/3] file descriptor passing using getfd over QMP
Date: Mon, 4 Jun 2012 09:10:07 -0400 [thread overview]
Message-ID: <1338815410-24890-1-git-send-email-coreyb@linux.vnet.ibm.com> (raw)
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.
This patch series adds the getfd QMP monitor command, which allows
an fd to be passed via SCM_RIGHTS, and returns the received file
descriptor. Support is also added to the block layer to allow QEMU
to dup() the fd when the filename is of the /dev/fd/X format. This
is useful if MAC policy prevents QEMU from open()ing specific types
of files.
This solution will enable libvirt to open() an image file and push
the file descriptor down to QEMU. When QEMU needs to "open" a file,
it will first check if the filename is of the /dev/fd/X format and
dup(X) if so. Otherwise it will continue and open() the file as it
has in the past.
This series reuses the file_open() function that Anthony Liguori
<aliguori@us.ibm.com> created in a recent fd passing prototype. It
also reuses the test driver that Stefan Hajnoczi
<stefanha@linux.vnet.ibm.com> created for that prototype, but with
several modifications.
Corey Bryant (3):
qmp/hmp: Add QMP getfd command that returns fd
block: Add support to "open" /dev/fd/X filenames
Sample server that opens image files for QEMU
block.c | 15 +++
block/raw-posix.c | 20 ++--
block/raw-win32.c | 4 +-
block/vdi.c | 5 +-
block/vmdk.c | 21 ++--
block/vpc.c | 2 +-
block/vvfat.c | 21 ++--
block_int.h | 13 +++
hmp-commands.hx | 2 +-
monitor.c | 37 +++++-
qapi-schema.json | 13 +++
qmp-commands.hx | 6 +-
test-fd-passing.c | 321 +++++++++++++++++++++++++++++++++++++++++++++++++++++
13 files changed, 439 insertions(+), 41 deletions(-)
create mode 100644 test-fd-passing.c
--
1.7.10.2
next reply other threads:[~2012-06-04 14:04 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-04 13:10 Corey Bryant [this message]
2012-06-04 13:10 ` [Qemu-devel] [PATCH 1/3] qmp/hmp: Add QMP getfd command that returns fd Corey Bryant
2012-06-04 14:45 ` Kevin Wolf
2012-06-04 15:57 ` Corey Bryant
2012-06-05 18:30 ` Luiz Capitulino
2012-06-06 14:04 ` Corey Bryant
2012-06-06 17:50 ` Luiz Capitulino
2012-06-06 19:42 ` Corey Bryant
2012-06-08 10:46 ` Daniel P. Berrange
2012-06-08 13:17 ` Corey Bryant
2012-06-04 13:10 ` [Qemu-devel] [PATCH 2/3] block: Add support to "open" /dev/fd/X filenames Corey Bryant
2012-06-04 14:32 ` Eric Blake
2012-06-04 15:51 ` Corey Bryant
2012-06-04 16:03 ` Eric Blake
2012-06-04 16:28 ` Corey Bryant
2012-06-04 16:36 ` Eric Blake
2012-06-04 16:40 ` Corey Bryant
2012-06-04 14:54 ` Kevin Wolf
2012-06-04 16:07 ` Corey Bryant
2012-06-04 13:10 ` [Qemu-devel] [PATCH 3/3] Sample server that opens image files for QEMU Corey Bryant
2012-06-04 15:01 ` Kevin Wolf
2012-06-04 16:15 ` Corey Bryant
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=1338815410-24890-1-git-send-email-coreyb@linux.vnet.ibm.com \
--to=coreyb@linux.vnet.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.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).