Merge pull request from cyphar/bindmount-types

specconv: always set "type: bind" in case of MS_BIND
This commit is contained in:
Mrunal Patel 2019-05-07 15:47:58 -07:00 committed by GitHub
commit 2484581dd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions
libcontainer/specconv

View File

@ -277,9 +277,10 @@ func createLibcontainerMount(cwd string, m specs.Mount) *configs.Mount {
source := m.Source source := m.Source
device := m.Type device := m.Type
if flags&unix.MS_BIND != 0 { if flags&unix.MS_BIND != 0 {
if device == "" { // Any "type" the user specified is meaningless (and ignored) for
device = "bind" // bind-mounts -- so we set it to "bind" because rootfs_linux.go
} // (incorrectly) relies on this for some checks.
device = "bind"
if !filepath.IsAbs(source) { if !filepath.IsAbs(source) {
source = filepath.Join(cwd, m.Source) source = filepath.Join(cwd, m.Source)
} }