Skip to content

Commit 3d9cbf0

Browse files
committed
Merge pull request moby#11758 from crosbymichael/update-libct-mar25
Update libcontainer to a6044b701c166fe538fc760f9e2
2 parents 54a607a + b4196f7 commit 3d9cbf0

File tree

6 files changed

+16
-25
lines changed

6 files changed

+16
-25
lines changed

hack/vendor.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ rm -rf src/github.com/docker/distribution
7575
mkdir -p src/github.com/docker/distribution
7676
mv tmp-digest src/github.com/docker/distribution/digest
7777

78-
clone git github.com/docker/libcontainer fd0087d3acdc4c5865de1829d4accee5e3ebb658
78+
clone git github.com/docker/libcontainer a6044b701c166fe538fc760f9e2dcea3d737cd2a
7979
# see src/github.com/docker/libcontainer/update-vendor.sh which is the "source of truth" for libcontainer deps (just like this file)
8080
rm -rf src/github.com/docker/libcontainer/vendor
8181
eval "$(grep '^clone ' src/github.com/docker/libcontainer/update-vendor.sh | grep -v 'github.com/codegangsta/cli' | grep -v 'github.com/Sirupsen/logrus')"

vendor/src/github.com/docker/libcontainer/cgroups/fs/apply_raw.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,6 @@ func (m *Manager) Freeze(state configs.FreezerState) error {
173173
if err != nil {
174174
return err
175175
}
176-
if !cgroups.PathExists(dir) {
177-
return cgroups.NewNotFoundError("freezer")
178-
}
179176

180177
prevState := m.Cgroups.Freezer
181178
m.Cgroups.Freezer = state
@@ -200,9 +197,6 @@ func (m *Manager) GetPids() ([]int, error) {
200197
if err != nil {
201198
return nil, err
202199
}
203-
if !cgroups.PathExists(dir) {
204-
return nil, cgroups.NewNotFoundError("devices")
205-
}
206200

207201
return cgroups.ReadProcsFile(dir)
208202
}

vendor/src/github.com/docker/libcontainer/init_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func populateProcessEnvironment(env []string) error {
9191

9292
// finalizeNamespace drops the caps, sets the correct user
9393
// and working dir, and closes any leaked file descriptors
94-
// before execing the command inside the namespace
94+
// before executing the command inside the namespace
9595
func finalizeNamespace(config *initConfig) error {
9696
// Ensure that all non-standard fds we may have accidentally
9797
// inherited are marked close-on-exec so they stay out of the

vendor/src/github.com/docker/libcontainer/rootfs_linux.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ func reOpenDevNull(rootfs string) error {
186186
func createDevices(config *configs.Config) error {
187187
oldMask := syscall.Umask(0000)
188188
for _, node := range config.Devices {
189-
if err := createDeviceNode(config.Rootfs, node); err != nil {
189+
// containers running in a user namespace are not allowed to mknod
190+
// devices so we can just bind mount it from the host.
191+
if err := createDeviceNode(config.Rootfs, node, config.Namespaces.Contains(configs.NEWUSER)); err != nil {
190192
syscall.Umask(oldMask)
191193
return err
192194
}
@@ -196,20 +198,13 @@ func createDevices(config *configs.Config) error {
196198
}
197199

198200
// Creates the device node in the rootfs of the container.
199-
func createDeviceNode(rootfs string, node *configs.Device) error {
201+
func createDeviceNode(rootfs string, node *configs.Device, bind bool) error {
200202
dest := filepath.Join(rootfs, node.Path)
201203
if err := os.MkdirAll(filepath.Dir(dest), 0755); err != nil {
202204
return err
203205
}
204-
if err := mknodDevice(dest, node); err != nil {
205-
if os.IsExist(err) {
206-
return nil
207-
}
208-
if err != syscall.EPERM {
209-
return err
210-
}
211-
// containers running in a user namespace are not allowed to mknod
212-
// devices so we can just bind mount it from the host.
206+
207+
if bind {
213208
f, err := os.Create(dest)
214209
if err != nil && !os.IsExist(err) {
215210
return err
@@ -219,6 +214,12 @@ func createDeviceNode(rootfs string, node *configs.Device) error {
219214
}
220215
return syscall.Mount(node.Path, dest, "bind", syscall.MS_BIND, "")
221216
}
217+
if err := mknodDevice(dest, node); err != nil {
218+
if os.IsExist(err) {
219+
return nil
220+
}
221+
return err
222+
}
222223
return nil
223224
}
224225

vendor/src/github.com/docker/libcontainer/update-vendor.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ clone git github.com/codegangsta/cli 1.1.0
4444
clone git github.com/coreos/go-systemd v2
4545
clone git github.com/godbus/dbus v2
4646
clone git github.com/Sirupsen/logrus v0.6.6
47-
clone git github.com/syndtr/gocapability e55e583369
47+
clone git github.com/syndtr/gocapability 8e4cdcb
4848

4949
# intentionally not vendoring Docker itself... that'd be a circle :)

vendor/src/github.com/syndtr/gocapability/capability/capability_linux.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -417,18 +417,14 @@ func (c *capsV3) Load() (err error) {
417417
}
418418

419419
func (c *capsV3) Apply(kind CapType) (err error) {
420-
err = initLastCap()
421-
if err != nil {
422-
return
423-
}
424420
if kind&BOUNDS == BOUNDS {
425421
var data [2]capData
426422
err = capget(&c.hdr, &data[0])
427423
if err != nil {
428424
return
429425
}
430426
if (1<<uint(CAP_SETPCAP))&data[0].effective != 0 {
431-
for i := Cap(0); i <= capLastCap; i++ {
427+
for i := Cap(0); i <= CAP_LAST_CAP; i++ {
432428
if c.Get(BOUNDING, i) {
433429
continue
434430
}

0 commit comments

Comments
 (0)