Bug 642051 - Xvfb SELinux issues in mock
Summary: Xvfb SELinux issues in mock
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: 14
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Clark Williams
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-10-11 21:09 UTC by Orion Poplawski
Modified: 2013-01-10 06:16 UTC (History)
6 users (show)

Fixed In Version: mock-1.1.10-1.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-03-03 08:28:48 UTC


Attachments (Terms of Use)

Description Orion Poplawski 2010-10-11 21:09:44 UTC
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 20:14:31 UTC
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 21:13:42 UTC
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 19:51:19 UTC
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 19:57:30 UTC
Is this what you mean?

# semodule -l | grep mock
mock    1.0.0

Comment 5 Clark Williams 2010-10-13 20:12:57 UTC
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 20:24:42 UTC
INFO: mock.py version 1.1.5 starting...
State Changed: init plugins
INFO: selinux enabled

Comment 7 Paul Howarth 2010-10-14 10:17:28 UTC
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 12:30:08 UTC
Yes there is a another bug on Mock with the same solution.

Comment 9 Clark Williams 2010-10-14 13:09:38 UTC
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 23:26:44 UTC
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 15:41:24 UTC
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 15:41:52 UTC
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 15:44:00 UTC
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 15:46:23 UTC
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 16:15:00 UTC
Fixes it for me.  Thanks!

Comment 16 Clark Williams 2010-10-20 19:21:03 UTC
\o/

Pushed to testing

Comment 17 Fedora Update System 2010-10-21 05:56:29 UTC
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 22:22:04 UTC
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 20:58:37 UTC
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 16:14:11 UTC
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 20:04:23 UTC
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 20:25:03 UTC
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 20:48:31 UTC
so when you run --shell, what's failing?

Comment 24 Orion Poplawski 2011-02-11 21:54:12 UTC
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-20 02:26:33 UTC
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-20 02:29:40 UTC
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-20 02:32:32 UTC
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-20 02:35:25 UTC
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 05:55:22 UTC
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 08:25:12 UTC
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 08:34:01 UTC
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 20:34:16 UTC
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 20:38:54 UTC
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 20:43:09 UTC
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 20:47:28 UTC
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 20:51:43 UTC
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 04:35:39 UTC
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-25 02:42:59 UTC
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-25 03:17:20 UTC
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 19:07:11 UTC
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 19:17:04 UTC
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.