RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1225556 - docker relabel of volumes is buggy if the mode is "roz"
Summary: docker relabel of volumes is buggy if the mode is "roz"
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: docker
Version: 7.1
Hardware: Unspecified
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: Daniel Walsh
QA Contact: Luwen Su
URL:
Whiteboard:
Depends On: 1225549
Blocks: 1211379
TreeView+ depends on / blocked
 
Reported: 2015-05-27 16:30 UTC by Laurent Rineau
Modified: 2019-03-06 01:52 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Docker is not performing relabel, if the volume is specified with more then one object, z: works, roz: fails. Consequence: You can not mount a volume that is both readonly and needs a relabel at the same time. Fix: Fix the labeling check. Result: You can mount a volume that is both readonly and needs relabel at same time.
Clone Of: 1225549
Environment:
Last Closed: 2015-06-23 09:30:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1167 0 normal SHIPPED_LIVE docker bug fix update 2015-06-23 13:29:05 UTC

Description Laurent Rineau 2015-05-27 16:30:48 UTC
Docker version 1.6.0-11.0.1.el7 has been pushed to RHEL 7.1 (I am actually using CentOS 7.1). That version contains the relabelling feature for volumes, but the following commit of libcontainer is not is 1.6.0-11.0.1.el7:

https://github.com/docker/libcontainer/commit/4518bce5bb440fc6bed37e658c2aad7855633ced

The bug is in label/label_selinux.go of libcontainer, in the function `func Relabel(path string, fileLabel string, relabel string)`. If the volume is suffixed with `:roz` for the mode, then the `relabel` variable value is `roz`. As the value is not 'z', the volume is relabelled using a private label, instead of being shared. The quoted commit clearly fixes the bug.

Daniel J. Walsh already said that the bug would be fixed in docker-1.6.2 (see the comments at the bottom of the Github page for the commit). I fill this bug report for the record.

Comment 1 Laurent Rineau 2015-05-27 16:33:38 UTC
I set the severity to "high" because that bug prevents the possibility to share read-only volumes between several containers. I had to downgrade to 
1.5.0-28.el7 so that my containers work again.

Comment 2 Daniel Walsh 2015-05-27 16:44:15 UTC
Fixed in docker 1.6.2

Comment 3 Laurent Rineau 2015-06-02 15:16:41 UTC
Is there somewhere I can get access to the sources of the docker-1.6.2 RPM? I would like to test it even before it is released. I read somewhere that the Git for RHEL is shared on CentOS here: git.centos.org, but it must be wrong because all I see at https://git.centos.org/forks/rpms!docker is about CentOS, and not RHEL.

Comment 7 Lokesh Mandvekar 2015-06-15 16:02:25 UTC
Laurent, could you try this please:

'yum install https://lsm5.fedorapeople.org/docker-1.6.2-12.el7.x86_64.rpm https://lsm5.fedorapeople.org/docker-selinux-1.6.2-12.el7.x86_64.rpm'

Comment 8 Laurent Rineau 2015-06-15 16:19:44 UTC
I have the impression that it is not fixed.

cgal ~/Git/cgal-testsuite-dockerfiles $ rpm -q docker docker-selinux
docker-1.6.2-12.el7.x86_64
docker-selinux-1.6.2-12.el7.x86_64
cgal ~/Git/cgal-testsuite-dockerfiles $ docker version
Client version: 1.6.2
Client API version: 1.18
Go version (client): go1.4.2
Git commit (client): eb12bd2-dirty
OS/Arch (client): linux/amd64
Server version: 1.6.2
Server API version: 1.18
Go version (server): go1.4.2
Git commit (server): eb12bd2-dirty
OS/Arch (server): linux/amd64
cgal ~/Git/cgal-testsuite-dockerfiles $ ls -lZd test*/
drwxr-xr-x. lrineau geometryfactory system_u:object_r:svirt_sandbox_file_t:s0 testresults/
drwxr-xr-x. lrineau geometryfactory system_u:object_r:svirt_sandbox_file_t:s0 testsuite/
cgal ~/Git/cgal-testsuite-dockerfiles $ docker run --rm -v $PWD/testsuite:/testsuite:roz -v $PWD/testresults:/testresults:rwz fedora /bin/bash -c 'ls -lZd /test*'
drwxr-xr-x. 500 501 system_u:object_r:svirt_sandbox_file_t:s0:c200,c705 /testresults
drwxr-xr-x. 500 501 system_u:object_r:svirt_sandbox_file_t:s0:c200,c705 /testsuite

One volume was declared with :roz and the other with :rwz, and both have been relabeled to the private security level s0:c200,c705.

Is there something wrong in my command line to create/launch the container?

Comment 11 Luwen Su 2015-06-16 03:37:41 UTC
(In reply to Lokesh Mandvekar from comment #10)
> sorry my bad, please try: yum install
> https://lsm5.fedorapeople.org/docker-1.6.2-14.el7.x86_64.rpm
> https://lsm5.fedorapeople.org/docker-selinux-1.6.2-14.el7.x86_64.rpm

Thanks! It works fine for me
# docker run -v /root/test:/test:z --rm rhel7 ls -aZ / | grep test
drwxr-xr-x. root root system_u:object_r:svirt_sandbox_file_t:s0 test

# docker run -v /root/test:/test:roz --rm rhel7 ls -aZ / | grep test
drwxr-xr-x. root root system_u:object_r:svirt_sandbox_file_t:s0 test

Move to verified

Comment 12 Laurent Rineau 2015-06-22 12:12:31 UTC
(In reply to Lokesh Mandvekar from comment #10)
> sorry my bad, please try: yum install
> https://lsm5.fedorapeople.org/docker-1.6.2-14.el7.x86_64.rpm
> https://lsm5.fedorapeople.org/docker-selinux-1.6.2-14.el7.x86_64.rpm

I confirm those builds fix the bug. Thanks.

Comment 14 errata-xmlrpc 2015-06-23 09:30:00 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.

https://rhn.redhat.com/errata/RHBA-2015-1167.html

Comment 15 Laurent Rineau 2015-06-28 16:04:24 UTC
The new build is now officially on CentOS 7. Thanks a lot for the fix!


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