qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: libvir-list@redhat.com, qemu-devel <qemu-devel@nongnu.org>,
	Khoa Huynh <khoa@us.ibm.com>, George Wilson <gcwilson@us.ibm.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	laine@laine.org
Subject: Re: [Qemu-devel] QEMU fstatfs(2) and libvirt SELinux policy
Date: Fri, 9 Mar 2012 16:08:01 +0000	[thread overview]
Message-ID: <20120309160800.GF2480@redhat.com> (raw)
In-Reply-To: <CAJSP0QUvcm_L4kf+6tDupQbEjAtLnOyEcTxddFqWVr4OY_k+NQ@mail.gmail.com>

On Fri, Mar 09, 2012 at 11:32:47AM +0000, Stefan Hajnoczi wrote:
> Hi,
> I have a question about the libvirt SELinux policy that can be applied
> to QEMU processes.  Yesterday Laine helped Khoa and me diagnose an
> issue where QEMU was doing fstatfs(2) but SELinux prevented this
> FILESYSTEM__GETATTR operation, resulting in a failed syscall with
> -EACCES.  The SELinux hook is:
> 
> security/selinux/hooks.c:selinux_sb_statfs():
>         return superblock_has_perm(cred, dentry->d_sb,
> FILESYSTEM__GETATTR, &ad);
> 
> It turns out this problem also affects XFS discard support in QEMU
> today.  QEMU calls platform_test_xfs_fd() in libxfs, which works like
> this:
> 
> static __inline__ int platform_test_xfs_fd(int fd)
> {
>         struct statfs buf;
>         if (fstatfs(fd, &buf) < 0)
>                 return 0;
>         return (buf.f_type == 0x58465342);      /* XFSB */
> }
> 
> In other words, XFS detection will fail when SELinux is enabled.
> 
> I'm not familiar with libvirt's use of SELinux.  Can someone explain
> if we need to expand the policy in libvirt and how to do that?

Just file a BZ against 'selinux-policy' in Fedora and provide the AVC
record from /var/log/audit/audit.log and a note explaining why we
should allow this. Dan Walsh will quickly update the policy to comply


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

      parent reply	other threads:[~2012-03-09 16:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-09 11:32 [Qemu-devel] QEMU fstatfs(2) and libvirt SELinux policy Stefan Hajnoczi
2012-03-09 14:16 ` Jiri Denemark
2012-03-09 15:11   ` Laine Stump
2012-03-09 15:19     ` Stefan Hajnoczi
2012-03-09 16:07     ` Stefan Hajnoczi
2012-03-09 17:16       ` Paolo Bonzini
2012-03-10  7:30         ` Stefan Hajnoczi
2012-03-24 14:47         ` Christoph Hellwig
2012-03-24 14:46       ` Christoph Hellwig
2012-03-09 15:23 ` George Wilson
2012-03-09 16:08 ` Daniel P. Berrange [this message]

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=20120309160800.GF2480@redhat.com \
    --to=berrange@redhat.com \
    --cc=gcwilson@us.ibm.com \
    --cc=khoa@us.ibm.com \
    --cc=laine@laine.org \
    --cc=libvir-list@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.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).