Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1603201 - [Regression] docker can't bindmount symbolic links to namespaces (/proc/PID/ns/*)
[Regression] docker can't bindmount symbolic links to namespaces (/proc/PID/n...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: docker (Show other bugs)
7.5
Unspecified Unspecified
medium Severity high
: rc
: ---
Assigned To: Frantisek Kluknavsky
atomic-bugs@redhat.com
: Extras, Regression
Depends On:
Blocks: 1186913 1571903
  Show dependency treegraph
 
Reported: 2018-07-19 08:41 EDT by Sergio Lopez
Modified: 2018-08-16 12:06 EDT (History)
11 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Previously, bind mounts were resolved before using them inside a container. Consequently, symlinks could not be mounted inside of the container. With this update, the source of a bind mount is not resolved. As a result, it is possible to bind mount symlinks again into a container.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2018-08-16 12:05:57 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:2482 None None None 2018-08-16 12:06 EDT

  None (edit)
Description Sergio Lopez 2018-07-19 08:41:53 EDT
Description of problem:

Starting on version docker-1.13.1-63.git94f4240.el7.x86_64, docker can't no longer bindmount symbolic links to namespaces (/proc/PID/ns/*):

# docker run --privileged -it  -v /proc/1/ns/net:/aaa rhel7 /bin/bash
/usr/bin/docker-current: Error response from daemon: error while creating mount source path '/proc/1/ns/net:[4026531956]': mkdir /proc/1/ns/net:[4026531956]: no such file or directory.

This worked on previous versions (docker-1.13.1-58.git87f2fab.el7.x86_64 or lower).


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

docker-1.13.1-63.git94f4240.el7.x86_64


How reproducible:

Always.


Additional info:

This problem can be tracked down to this change:

 - https://github.com/projectatomic/docker/commit/1fc7510329f938b7d38fd8989bd462201d0fe13a

volume/volume.go:
 // Setup sets up a mount point by either mounting the volume if it is
 // configured, or creating the source directory if supplied.
-func (m *MountPoint) Setup(mountLabel string, rootUID, rootGID int) (path string, err error) {
+func (m *MountPoint) Setup(prefix, mountLabel string, rootUID, rootGID int) (path string, err error) {
+	symlinkRoot := prefix
+	if symlinkRoot == "" {
+		symlinkRoot = "/"
+	}
+	sourcePath, err := symlink.FollowSymlinkInScope(filepath.Join(prefix, m.Source), symlinkRoot)
+	if err != nil {
+		path = ""
+		err = errors.Wrapf(err, "error evaluating symlink from mount source '%s'", m.Source)
+		return
+	}
+

The use of FollowSymlinkInScope on m.Source alters docker's by following symlinks in the source path of the bindmount. In the case of a symbolic link to a namespace, it produces the following transformation:

 - /proc/1/ns/net -> /proc/1/ns/net:[4026531956]

And the later doesn't really exist in the filesystem.

I've checked upstream, and this change isn't there, so this is a downstream regression.
Comment 4 Giuseppe Scrivano 2018-07-19 10:29:44 EDT
Pull requests here:

https://github.com/projectatomic/docker/pull/316
https://github.com/projectatomic/docker/pull/317

Sergio, we are using this feature in the docker system container, so this is probably not useful upstream.
Comment 5 Sergio Lopez 2018-07-19 10:41:10 EDT
Hi Giuseppe,

Thanks for the explanation and the quick fix. I'll create a test build once the PRs are merged.

Sergio (slp).
Comment 19 Luwen Su 2018-08-05 13:36:31 EDT
Package version:
docker-1.13.1-74.git6e3bb8e.el7.x86_64

# docker run --privileged -it  -v /proc/1/ns/net:/aaa rhel7 /bin/bash
[root@ab28cbc039d9 /]# ls /aaa
/aaa
[root@ab28cbc039d9 /]# exit
exit
Comment 22 errata-xmlrpc 2018-08-16 12:05:57 EDT
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://access.redhat.com/errata/RHSA-2018:2482

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