From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Si8hn-000461-7q for qemu-devel@nongnu.org; Fri, 22 Jun 2012 14:35:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Si8hl-0007xv-GG for qemu-devel@nongnu.org; Fri, 22 Jun 2012 14:35:38 -0400 Received: from e38.co.us.ibm.com ([32.97.110.159]:40845) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Si8hl-0007xa-9g for qemu-devel@nongnu.org; Fri, 22 Jun 2012 14:35:37 -0400 Received: from /spool/local by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 22 Jun 2012 12:35:33 -0600 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 56C2B19D804C for ; Fri, 22 Jun 2012 18:35:26 +0000 (WET) Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q5MIZL2c169768 for ; Fri, 22 Jun 2012 12:35:23 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q5MIZLhW003631 for ; Fri, 22 Jun 2012 12:35:21 -0600 From: Corey Bryant Date: Fri, 22 Jun 2012 14:36:07 -0400 Message-Id: <1340390174-7493-1-git-send-email-coreyb@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH v4 0/7] file descriptor passing using pass-fd List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, aliguori@us.ibm.com, stefanha@linux.vnet.ibm.com, libvir-list@redhat.com, lcapitulino@redhat.com, pbonzini@redhat.com, eblake@redhat.com 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 pass-fd 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 opening specific types of files. One nice thing about this approach is that 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 (7): qemu-char: Add MSG_CMSG_CLOEXEC flag to recvmsg qapi: Convert getfd and closefd qapi: Add pass-fd QMP command qapi: Re-arrange monitor.c functions block: Prevent /dev/fd/X filename from being detected as floppy block: Convert open calls to qemu_open osdep: Enable qemu_open to dup pre-opened fd block/raw-posix.c | 22 +++++----- block/raw-win32.c | 4 +- block/vdi.c | 5 ++- block/vmdk.c | 21 ++++------ block/vpc.c | 2 +- block/vvfat.c | 21 +++++----- cutils.c | 26 +++++++++--- dump.c | 3 +- hmp-commands.hx | 6 +-- hmp.c | 18 ++++++++ hmp.h | 2 + main-loop.c | 6 +-- migration-fd.c | 2 +- monitor.c | 120 ++++++++++++++++++++++++++++++++--------------------- monitor.h | 2 +- net.c | 6 ++- osdep.c | 91 ++++++++++++++++++++++++++++++++++++++++ qapi-schema.json | 71 +++++++++++++++++++++++++++++++ qemu-char.c | 2 +- qemu-common.h | 2 +- qmp-commands.hx | 56 ++++++++++++++++++++++--- 21 files changed, 378 insertions(+), 110 deletions(-) -- 1.7.10.2