Bug 637555 - Mock selinux plugin creates /proc/filesystems with incorrect permissions
Mock selinux plugin creates /proc/filesystems with incorrect permissions
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: mock (Show other bugs)
13
All Linux
low Severity medium
: ---
: ---
Assigned To: Clark Williams
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-09-26 11:00 EDT by Carl Roth
Modified: 2013-01-10 01:14 EST (History)
4 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: 2010-10-28 18:22:24 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
untested patch to fix selinux plugiin permissions problems (924 bytes, patch)
2010-09-27 10:46 EDT, Clark Williams
no flags Details | Diff
updated patch with modified permissions (1.82 KB, patch)
2010-09-28 11:17 EDT, Clark Williams
no flags Details | Diff

  None (edit)
Description Carl Roth 2010-09-26 11:00:56 EDT
Description of problem:

The new(ish) selinux plugin for mock creates /proc/filesystems using a temporary file and bind mount; this temporary file is created by default with 0600 permissions.

As a result, processes inside the chroot running in userland cannot read /proc/filesystems.  This breaks some spec files that need to read /proc/filesystems (e.g. for the 'mlocate' or 'updatedb' tool).

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

mock-1.1.5-1.fc13

How reproducible:

Always

Steps to Reproduce:
1. create a spec file
2. in the %build stanza, add 'wc -l /proc/filesystems'
3. try to build the SRPM using mock
  
Actual results:

SRPM build fails with permissions error

Expected results:


Additional info:

I think the fix is simple (at least, I implemented it with a supplemental mock plugin).  In the selinux preinit hook, there should also be something like

  self.rootObj.mountCmds.append("chmod go+r %s" % self.filesystems)

This opens up the read permissions on the bind-mounted file so that userland processes can read it.
Comment 1 Clark Williams 2010-09-27 10:46:12 EDT
Created attachment 449907 [details]
untested patch to fix selinux plugiin permissions problems

Rather than shell out again, I thought we could just set the permissions after the temp file was created, using os.chmod(). Would you try the attached patch ad see if it fixes your problem?
Comment 2 Carl Roth 2010-09-28 11:01:40 EDT
I verified that this patch works on my system.  Note that the permissions you chose:

  stat.S_IWUSR|stat.S_IRUSR|stat.S_IRGRP|stat.S_IWGRP|stat.S_IROTH|stat.S_IWOTH

are probably too broad.  The actual /proc/filesystems entry AFAIK is only

  stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH
Comment 3 Clark Williams 2010-09-28 11:17:00 EDT
Created attachment 450215 [details]
updated patch with modified permissions

Ahh, good point. I've attached a modified patch which sets permissions to read-only for everyone. 

I'll try and get an update out this week
Comment 4 Clark Williams 2010-10-14 23:25:51 EDT
New version of mock in koji (mock-1.1.6) that contains this fix:

https://koji.fedoraproject.org/koji/buildinfo?buildID=200570
Comment 5 Nalin Dahyabhai 2010-10-15 15:09:47 EDT
This packages fixes it for me.
Comment 6 Fedora Update System 2010-10-20 11:41:18 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 7 Fedora Update System 2010-10-20 11:41:48 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 8 Fedora Update System 2010-10-20 11:43:55 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 9 Fedora Update System 2010-10-20 11:46:18 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 10 Fedora Update System 2010-10-21 01:56:24 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 11 Fedora Update System 2010-10-28 18:22:00 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 12 Fedora Update System 2010-11-01 16:58:32 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 13 Fedora Update System 2010-12-14 11:14:06 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 14 Fedora Update System 2011-01-18 15:04:17 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 15 Fedora Update System 2011-02-19 21:26:27 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 16 Fedora Update System 2011-02-19 21:29:35 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 17 Fedora Update System 2011-02-19 21:32:27 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 18 Fedora Update System 2011-02-19 21:35:20 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 19 Fedora Update System 2011-03-03 03:25:05 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 20 Fedora Update System 2011-03-03 03:33:56 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 21 Fedora Update System 2011-05-13 16:34:10 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 22 Fedora Update System 2011-05-13 16:38:49 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 23 Fedora Update System 2011-05-13 16:43:05 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 24 Fedora Update System 2011-05-13 16:47:23 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 25 Fedora Update System 2011-05-13 16:51:38 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 26 Fedora Update System 2011-05-19 00:35:32 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 27 Fedora Update System 2011-05-24 22:42:53 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 28 Fedora Update System 2011-05-24 23:17:14 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 29 Fedora Update System 2011-06-02 15:07:05 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 30 Fedora Update System 2011-06-02 15:16:59 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.