Bug 999922 - Policy denies libvirtd the permission to relabel unix domain sockets
Policy denies libvirtd the permission to relabel unix domain sockets
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: selinux-policy (Show other bugs)
All Linux
unspecified Severity unspecified
: rc
: ---
Assigned To: Miroslav Grepl
BaseOS QE Security Team
Depends On:
Blocks: 999292
  Show dependency treegraph
Reported: 2013-08-22 07:25 EDT by Daniel Berrange
Modified: 2013-10-30 05:46 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 999926 (view as bug list)
Last Closed: 2013-10-30 05:46:26 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Daniel Berrange 2013-08-22 07:25:59 EDT
Description of problem:
With the virDomainOpenGraphics() API, a client app running unconfined creates a UNIX domain socket (using socketpair()). These socket FDs are label unconfined. It then passes one of these sockets to libvirtd using virDomainOpenGraphics, which passes the socket onto QEMU.

Before passing the socket to QEMU, libvirt must relabel it to svirt_image_t to allow QEMU the ability to use the socket - otherwise it gets silently dropped by sendmsg/recvmsg with an AVC

type=AVC msg=audit(1377167900.795:1188): avc:  denied  { getattr } for  pid=6642 comm="qemu-system-x86" scontext=unconfined_u:system_r:svirt_t:s0:c264,c560 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tclass=unix_stream_socket

The fix to make libvirtd do this relabelling is tracked in bug 999914.

When I fix it to do relabelling though, libvirtd itself now triggers an AVC

type=AVC msg=audit(1377168984.442:1190): avc:  denied  { relabelto } for  pid=3521 comm="lt-libvirtd" name="UNIX" dev="sockfs" ino=879718 scontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:svirt_image_t:s0:c264,c560 tclass=unix_stream_socket

IIUC, the problem is the virt.te policy has the following rule

allow virtd_t self:unix_stream_socket { connectto create_stream_socket_perms };

whereas I believe it should be

allow virtd_t self:unix_stream_socket { relabelto connectto create_stream_socket_perms };

Version-Release number of selected component (if applicable):

How reproducible:
Comment 2 Miroslav Grepl 2013-08-23 07:46:22 EDT
Could you re-test it with

Comment 3 Miroslav Grepl 2013-10-30 05:46:26 EDT
More fixes have been added during RHEL6.5 cycle related to libvirt and this bug should be fixed. If no, please re-open the bug and it will be addressed in RHEL6.6.

Note You need to log in before you can comment on or make changes to this bug.