qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] QEMU fstatfs(2) and libvirt SELinux policy
@ 2012-03-09 11:32 Stefan Hajnoczi
  2012-03-09 14:16 ` Jiri Denemark
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Stefan Hajnoczi @ 2012-03-09 11:32 UTC (permalink / raw)
  To: laine; +Cc: libvir-list, qemu-devel, Khoa Huynh, George Wilson, Paolo Bonzini

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?

Thanks,
Stefan

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

end of thread, other threads:[~2012-03-24 14:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).