Bug 642051 - Xvfb SELinux issues in mock
Xvfb SELinux issues in mock
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: mock (Show other bugs)
14
All Linux
low Severity medium
: ---
: ---
Assigned To: Clark Williams
Fedora Extras Quality Assurance
: Reopened, SELinux
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-10-11 17:09 EDT by Orion Poplawski
Modified: 2013-01-10 01:16 EST (History)
6 users (show)

See Also:
Fixed In Version: mock-1.1.10-1.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-03-03 03:28:48 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Orion Poplawski 2010-10-11 17:09:44 EDT
Description of problem:

I run a Xvfb server in the %check section of the plplot build to allow the running of various tests that require an X server.  This is no longer working in rawhide.

On my initial build I got:

SELinux: Failed to open x_contexts mapping in policy

and the server fails to start. So I added selinux-policy-targeted and now I get:

SELinux: Invalid object class mapping, disabling SELinux support.
Backtrace:
0: Xvfb (xorg_backtrace+0x2d) [0x5132f9]
1: Xvfb (0x400000+0x115cb6) [0x515cb6]
2: /lib64/libc.so.6 (0x2b52d986b000+0x340e0) [0x2b52d989f0e0]
3: /lib64/libselinux.so.1 (0x2b52d8166000+0x7274) [0x2b52d816d274]
4: /lib64/libselinux.so.1 (avc_destroy+0x116) [0x2b52d8174166]
5: Xvfb (0x400000+0x47929) [0x447929]
6: Xvfb (CloseDownExtensions+0x2b) [0x4e336d]
7: Xvfb (0x400000+0xc85d7) [0x4c85d7]
8: /lib64/libc.so.6 (__libc_start_main+0xfd) [0x2b52d9889e7d]
9: Xvfb (0x400000+0x19d09) [0x419d09]
Segmentation fault at address (nil)
Fatal server error:
Caught signal 11 (Segmentation fault). Server aborting

This is with mock 1.1.5 on a F13 host running 2.6.34.7-56.fc13.x86_64.  The koji builders work fine, so perhaps it detects the F13 kernel and tries to to more stuff that it does on the koji builders.


Version-Release number of selected component (if applicable):
xorg-x11-server-Xvfb-1.9.0-13.fc15.x86_64
Comment 1 Daniel Walsh 2010-10-12 16:14:31 EDT
I believe this is supposed to be fixed in F14 I am not sure mock was fixed in F13, to not put down labels.
Comment 2 Orion Poplawski 2010-10-12 17:13:42 EDT
Updated my mock machine to F14 and still get:

_XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created.
Fatal server error:
SELinux: Failed to open x_contexts mapping in policy
Comment 3 Clark Williams 2010-10-13 15:51:19 EDT
Orion, are you loading the SELinux plugin? If you're running SELinux on your build machine, then you need to. If you're loading it and you're getting SELinux problems, then we have a bug.
Comment 4 Orion Poplawski 2010-10-13 15:57:30 EDT
Is this what you mean?

# semodule -l | grep mock
mock    1.0.0
Comment 5 Clark Williams 2010-10-13 16:12:57 EDT
No, there's an selinux plugin in mock now. It should load by default, detect that the host system is running selinux in enforcing or permissive mode then bind mount a fake /proc/filesystems file in the chroot so that running things like sestatus in the chroot will return disabled. 

you should see a print at the start of the run that says:

INFO:  selinux enabled

or 

INFO:  selinux disabled

when the plugin initializes. This tells if the host system is running SELinux
Comment 6 Orion Poplawski 2010-10-13 16:24:42 EDT
INFO: mock.py version 1.1.5 starting...
State Changed: init plugins
INFO: selinux enabled
Comment 7 Paul Howarth 2010-10-14 06:17:28 EDT
There's a problem with the SELinux plugin in mock 1.1.5 in that it uses mkstemp() to create the dummy /proc/filesystems file and hence it's created with mode 0600, i.e. unreadable to processes running as user mockbuild in the chroot. This causes some versions of libselinux (including F-13 and RHEL-6 Beta) to return -1 for is_selinux_enabled(), which some users if teh library (e.g. openssh) treat as "enabled".

Simple fix is to fix the mode of the file to be 0444 like the real /proc/filesystems:


--- /usr/lib/python2.6/site-packages/mock/plugins/selinux.py.orig	2010-09-17 23:15:23.000000000 +0100
+++ /usr/lib/python2.6/site-packages/mock/plugins/selinux.py	2010-10-14 11:04:56.906097982 +0100
@@ -58,6 +58,7 @@
 
         os.close(self.fd)
         host.close()
+        os.chmod(self.filesystems, 0444)
 
         self.rootObj.mountCmds.append("mount -n --bind %s %s" % (self.filesystems, self.chrootFilesystems))
         self.rootObj.umountCmds.append("umount -n %s" % self.chrootFilesystems)
Comment 8 Daniel Walsh 2010-10-14 08:30:08 EDT
Yes there is a another bug on Mock with the same solution.
Comment 9 Clark Williams 2010-10-14 09:09:38 EDT
Argh, I've had the fix Paul mentions in my tree for a while now, just got caught up in other stuff. I'll push out a new mock later today which should fix the issue.
Comment 10 Clark Williams 2010-10-14 19:26:44 EDT
Orion, would you try the mock-1.1.6 build in koji:

https://koji.fedoraproject.org/koji/buildinfo?buildID=200570

and let me know if that clears up the SELinux permission problem?
Comment 11 Fedora Update System 2010-10-20 11:41:24 EDT
mock-1.1.6-1.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/mock-1.1.6-1.fc13
Comment 12 Fedora Update System 2010-10-20 11:41:52 EDT
mock-1.1.6-1.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/mock-1.1.6-1.fc14
Comment 13 Fedora Update System 2010-10-20 11:44:00 EDT
mock-1.0.13-1.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/mock-1.0.13-1.el5
Comment 14 Fedora Update System 2010-10-20 11:46:23 EDT
mock-1.0.13-1.fc12 has been submitted as an update for Fedora 12.
https://admin.fedoraproject.org/updates/mock-1.0.13-1.fc12
Comment 15 Orion Poplawski 2010-10-20 12:15:00 EDT
Fixes it for me.  Thanks!
Comment 16 Clark Williams 2010-10-20 15:21:03 EDT
\o/

Pushed to testing
Comment 17 Fedora Update System 2010-10-21 01:56:29 EDT
mock-1.1.6-1.fc13 has been pushed to the Fedora 13 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update mock'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/mock-1.1.6-1.fc13
Comment 18 Fedora Update System 2010-10-28 18:22:04 EDT
mock-1.1.6-1.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 19 Fedora Update System 2010-11-01 16:58:37 EDT
mock-1.1.6-1.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 20 Fedora Update System 2010-12-14 11:14:11 EST
mock-1.0.14-1.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/mock-1.0.14-1.el5
Comment 21 Fedora Update System 2011-01-18 15:04:23 EST
mock-1.0.15-1.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/mock-1.0.15-1.el5
Comment 22 Orion Poplawski 2011-02-11 15:25:03 EST
I'm going to reopen this because I seem to see the same problem when I run mock --shell, which is impacting my ability to troubleshoot a build failure.

mock-1.1.8-1.fc14.noarch
Comment 23 Clark Williams 2011-02-11 15:48:31 EST
so when you run --shell, what's failing?
Comment 24 Orion Poplawski 2011-02-11 16:54:12 EST
The Xvfb server doesn't start with:

Fatal server error:
SELinux: Failed to open x_contexts mapping in policy
Comment 25 Fedora Update System 2011-02-19 21:26:33 EST
mock-1.1.9-1.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/mock-1.1.9-1.fc13
Comment 26 Fedora Update System 2011-02-19 21:29:40 EST
mock-1.0.16-1.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/mock-1.0.16-1.el5
Comment 27 Fedora Update System 2011-02-19 21:32:32 EST
mock-1.1.9-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.1.9-1.el6
Comment 28 Fedora Update System 2011-02-19 21:35:25 EST
mock-1.1.9-1.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/mock-1.1.9-1.fc14
Comment 29 Fedora Update System 2011-02-20 00:55:22 EST
mock-1.0.16-1.el5 has been pushed to the Fedora EPEL 5 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update mock'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/mock-1.0.16-1.el5
Comment 30 Fedora Update System 2011-03-03 03:25:12 EST
mock-1.1.9-1.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 31 Fedora Update System 2011-03-03 03:34:01 EST
mock-1.1.9-1.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 32 Fedora Update System 2011-05-13 16:34:16 EDT
mock-1.1.10-1.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/mock-1.1.10-1.fc15
Comment 33 Fedora Update System 2011-05-13 16:38:54 EDT
mock-1.1.10-1.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/mock-1.1.10-1.fc14
Comment 34 Fedora Update System 2011-05-13 16:43:09 EDT
mock-1.0.17-1.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/mock-1.0.17-1.el5
Comment 35 Fedora Update System 2011-05-13 16:47:28 EDT
mock-1.1.10-1.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/mock-1.1.10-1.fc13
Comment 36 Fedora Update System 2011-05-13 16:51:43 EDT
mock-1.1.10-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.1.10-1.el6
Comment 37 Fedora Update System 2011-05-19 00:35:39 EDT
mock-1.1.10-1.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 38 Fedora Update System 2011-05-24 22:42:59 EDT
mock-1.1.10-1.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 39 Fedora Update System 2011-05-24 23:17:20 EDT
mock-1.1.10-1.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 40 Fedora Update System 2011-06-02 15:07:11 EDT
mock-1.0.17-1.el5 has been pushed to the Fedora EPEL 5 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 41 Fedora Update System 2011-06-02 15:17:04 EDT
mock-1.1.10-1.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.

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