Bug 741271

Summary: selinux-policy spice-vdagent rules need update because of new agent features
Product: Red Hat Enterprise Linux 6 Reporter: Hans de Goede <hdegoede>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: high    
Version: 6.1CC: dwalsh, mmalik
Target Milestone: rc   
Target Release: 6.2   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.7.19-115.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 10:19:29 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 740851, 747120    
Attachments:
Description Flags
avc-s selinux is denying which should be allowed
none
avc-s selinux is denying which should not be logged (silenced) none

Description Hans de Goede 2011-09-26 13:16:37 UTC
Created attachment 524902 [details]
avc-s selinux is denying which should be allowed

Hi,

Sorry about this, esp. after you just having fixed bug 737790, well at least
I'm learning and filing bugs before QA hits them now.

spice-vdagent has grown the capability to generate xorg.conf files, this may seem weird, but it is needed for multi monitor linux guests, since this uses Xinerama and that needs an xorg.conf, for more details see bug 740851.

This capability requires the vdagentd process to read some files under sysfs
(to get some pci device info through libpciaccess), which selinux currently is denying it.

I've run some tests with enforcing on / off. I'm going to attach 2 files, one named denied, this files contains things which selinux is denying which are breaking the new functionality. After running this through audit2allow everything works fine with selinux in enforcing mode.

The second file is called silence, this contains some denies which selinux is denying which are ok to deny, but it would be nice if the avc logging for these denies could be silenced.

Note I tested this with an F-16 guest, I'll go and update my RHEL-6 guest to the latest 6.2 bits and reproduce it there, but I don't expect any different results.

Thanks,

Hans

Comment 1 Hans de Goede 2011-09-26 13:17:35 UTC
Created attachment 524903 [details]
avc-s selinux is denying which should not be logged (silenced)

Comment 2 Miroslav Grepl 2011-09-26 14:10:53 UTC
Ok, any idea why sys_admin capability is needed?

CAP_SYS_ADMIN
              * Perform a range of system administration operations
                including:   quotactl(2),   mount(2),    umount(2),
                swapon(2),  swapoff(2),  sethostname(2), and setdo‐
                mainname(2);
              * perform IPC_SET and IPC_RMID  operations  on  arbi‐
                trary System V IPC objects;
              * perform operations on trusted and security Extended
                Attributes (see attr(5));
              * use lookup_dcookie(2);
              * use ioprio_set(2)  to  assign  IOPRIO_CLASS_RT  and
                (before  Linux 2.6.25) IOPRIO_CLASS_IDLE I/O sched‐
                uling classes;
              * forge UID when passing socket credentials;
              * exceed /proc/sys/fs/file-max, the system-wide limit
                on  the  number of open files, in system calls that
                open files (e.g.,  accept(2),  execve(2),  open(2),
                pipe(2));
              * employ   CLONE_NEWNS   flag   with   clone(2)   and
                unshare(2);
              * perform KEYCTL_CHOWN and  KEYCTL_SETPERM  keyctl(2)
                operations;
              * perform madvise(2) MADV_HWPOISON operation.

Comment 3 Hans de Goede 2011-09-26 14:28:01 UTC
(In reply to comment #2)
> Ok, any idea why sys_admin capability is needed?

No clue, I'm pretty sure this is coming from libpciaccess. Note that it is not
*needed* it is trying to do something which needs it but if that fails it goes on happily. I only ran the denied attachment through audit2allow (and loaded the resulting module) and that was enough. I deliberately did not run the other avc's through audit2allow as I didn't see how / why libpciaccess needs them for just enumerating, and indeed things work fine in enforcing mode with those being denied.

I guess it may have something to do with libpciaccess being meant to actually do pci device access (think iopl for example), while I'm only using it for enumeration.

Comment 4 Daniel Walsh 2011-09-26 16:02:33 UTC
Ok lets dontaudit and see if anyone complains.

Comment 5 Miroslav Grepl 2011-10-03 14:01:05 UTC
Fixed in selinux-policy-3.7.19-114.el6

Comment 7 Miroslav Grepl 2011-10-04 11:02:25 UTC
I am fixing the interface.

Comment 8 Miroslav Grepl 2011-10-05 13:39:44 UTC
Fixed in selinux-policy-3.7.19-115.el6

Comment 11 errata-xmlrpc 2011-12-06 10:19:29 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2011-1511.html