Skip to content

Commit 5ee2c2a

Browse files
Merge pull request moby#27160 from mlaventure/update-containerd
Update containerd and runc
2 parents 28cca5d + 7e12c3b commit 5ee2c2a

File tree

18 files changed

+84
-86
lines changed

18 files changed

+84
-86
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
222222
hello-world:latest@sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7
223223
# See also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is)
224224

225-
# Install tomlv, runc, containerd.and grimes
225+
# Install tomlv, runc, containerd and grimes
226226
# Please edit hack/dockerfile/install-binaries.sh to update them.
227227
COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh
228228
RUN /tmp/install-binaries.sh tomlv runc containerd grimes

Dockerfile.aarch64

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
165165
aarch64/hello-world:latest@sha256:65a4a158587b307bb02db4de41b836addb0c35175bdc801367b1ac1ddeb9afda
166166
# See also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is)
167167

168-
# Install tomlv, runc, containerd.and grimes
168+
# Install tomlv, runc, containerd and grimes
169169
# Please edit hack/dockerfile/install-binaries.sh to update them.
170170
COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh
171171
RUN /tmp/install-binaries.sh tomlv runc containerd grimes

Dockerfile.armhf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
164164
armhf/hello-world:latest@sha256:161dcecea0225975b2ad5f768058212c1e0d39e8211098666ffa1ac74cfb7791
165165
# See also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is)
166166

167-
# Install tomlv, runc, containerd.and grimes
167+
# Install tomlv, runc, containerd and grimes
168168
# Please edit hack/dockerfile/install-binaries.sh to update them.
169169
COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh
170170
RUN /tmp/install-binaries.sh tomlv runc containerd grimes

Dockerfile.ppc64le

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
183183
ppc64le/hello-world:latest@sha256:186a40a9a02ca26df0b6c8acdfb8ac2f3ae6678996a838f977e57fac9d963974
184184
# See also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is)
185185

186-
# Install tomlv, runc, containerd.and grimes
186+
# Install tomlv, runc, containerd and grimes
187187
# Please edit hack/dockerfile/install-binaries.sh to update them.
188188
COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh
189189
RUN /tmp/install-binaries.sh tomlv runc containerd grimes

Dockerfile.s390x

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
175175
s390x/hello-world:latest@sha256:780d80b3a7677c3788c0d5cd9168281320c8d4a6d9183892d8ee5cdd610f5699
176176
# See also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is)
177177

178-
# Install tomlv, runc, containerd.and grimes
178+
# Install tomlv, runc, containerd and grimes
179179
# Please edit hack/dockerfile/install-binaries.sh to update them.
180180
COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh
181181
RUN /tmp/install-binaries.sh tomlv runc containerd grimes

Dockerfile.simple

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ ENV PATH /go/bin:/usr/local/go/bin:$PATH
5656
ENV GOPATH /go:/go/src/github.com/docker/docker/vendor
5757
ENV CGO_LDFLAGS -L/lib
5858

59-
# Install runc, containerd.and grimes
59+
# Install runc, containerd and grimes
6060
# Please edit hack/dockerfile/install-binaries.sh to update them.
6161
COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh
6262
RUN /tmp/install-binaries.sh runc containerd grimes

hack/dockerfile/install-binaries.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ set -e
33
set -x
44

55
TOMLV_COMMIT=9baf8a8a9f2ed20a8e54160840c492f937eeaf9a
6-
RUNC_COMMIT=cc29e3dded8e27ba8f65738f40d251c885030a28
7-
CONTAINERD_COMMIT=2545227b0357eb55e369fa0072baef9ad91cdb69
6+
RUNC_COMMIT=02f8fa7863dd3f82909a73e2061897828460d52f
7+
CONTAINERD_COMMIT=837e8c5e1cad013ed57f5c2090c8591c10cbbdae
88
GRIMES_COMMIT=f207601a8d19a534cc90d9e26e037e9931ccb9db
99

1010
export GOPATH="$(mktemp -d)"

hack/vendor.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ clone git github.com/miekg/pkcs11 df8ae6ca730422dba20c768ff38ef7d79077a59f
106106
clone git github.com/docker/go v1.5.1-1-1-gbaf439e
107107
clone git github.com/agl/ed25519 d2b94fd789ea21d12fac1a4443dd3a3f79cda72c
108108

109-
clone git github.com/opencontainers/runc cc29e3dded8e27ba8f65738f40d251c885030a28 # libcontainer
109+
clone git github.com/opencontainers/runc 02f8fa7863dd3f82909a73e2061897828460d52f # libcontainer
110110
clone git github.com/opencontainers/runtime-spec 1c7c27d043c2a5e513a44084d2b10d77d1402b8c # specs
111111
clone git github.com/seccomp/libseccomp-golang 32f571b70023028bd57d9288c20efbcb237f3ce0
112112
# libcontainer deps (see src/github.com/opencontainers/runc/Godeps/Godeps.json)
@@ -140,7 +140,7 @@ clone git google.golang.org/cloud dae7e3d993bc3812a2185af60552bb6b847e52a0 https
140140
clone git github.com/docker/docker-credential-helpers v0.3.0
141141

142142
# containerd
143-
clone git github.com/docker/containerd 2545227b0357eb55e369fa0072baef9ad91cdb69
143+
clone git github.com/docker/containerd 837e8c5e1cad013ed57f5c2090c8591c10cbbdae
144144

145145
# cluster
146146
clone git github.com/docker/swarmkit 7e63bdefb94e5bea2641e8bdebae2cfa61a0ed44

integration-cli/docker_cli_daemon_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2778,7 +2778,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *check.C) {
27782778
c.Assert(err, checker.IsNil)
27792779

27802780
containerName := "error-values"
2781-
runError := "oci runtime error: exec: \"toto\": executable file not found in $PATH"
2781+
runError := `exec: \"toto\": executable file not found in $PATH`
27822782
// Make a container with both a non 0 exit code and an error message
27832783
out, err := s.d.Cmd("run", "--name", containerName, "busybox", "toto")
27842784
c.Assert(err, checker.NotNil)
@@ -2793,7 +2793,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *check.C) {
27932793
out, err = s.d.Cmd("inspect", "-f", "{{.State.Error}}", containerName)
27942794
out = strings.TrimSpace(out)
27952795
c.Assert(err, checker.IsNil)
2796-
c.Assert(out, checker.Equals, runError)
2796+
c.Assert(out, checker.Contains, runError)
27972797

27982798
// now restart daemon
27992799
err = s.d.Restart()
@@ -2808,7 +2808,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *check.C) {
28082808
out, err = s.d.Cmd("inspect", "-f", "{{.State.Error}}", containerName)
28092809
out = strings.TrimSpace(out)
28102810
c.Assert(err, checker.IsNil)
2811-
c.Assert(out, checker.Equals, runError)
2811+
c.Assert(out, checker.Contains, runError)
28122812
}
28132813

28142814
func (s *DockerDaemonSuite) TestDaemonBackcompatPre17Volumes(c *check.C) {

pkg/sysinfo/sysinfo_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const (
1818
)
1919

2020
func findCgroupMountpoints() (map[string]string, error) {
21-
cgMounts, err := cgroups.GetCgroupMounts()
21+
cgMounts, err := cgroups.GetCgroupMounts(false)
2222
if err != nil {
2323
return nil, fmt.Errorf("Failed to parse cgroup information: %v", err)
2424
}

vendor/src/github.com/opencontainers/runc/libcontainer/cgroups/cgroups.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ type Manager interface {
3737
// restore the object later.
3838
GetPaths() map[string]string
3939

40-
// Set the cgroup as configured.
40+
// Sets the cgroup as configured.
4141
Set(container *configs.Config) error
4242
}
4343

vendor/src/github.com/opencontainers/runc/libcontainer/cgroups/utils.go

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ import (
1616
"github.com/docker/go-units"
1717
)
1818

19-
const cgroupNamePrefix = "name="
19+
const (
20+
cgroupNamePrefix = "name="
21+
CgroupProcesses = "cgroup.procs"
22+
)
2023

2124
// https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt
2225
func FindCgroupMountpoint(subsystem string) (string, error) {
@@ -136,7 +139,7 @@ func (m Mount) GetThisCgroupDir(cgroups map[string]string) (string, error) {
136139
return getControllerPath(m.Subsystems[0], cgroups)
137140
}
138141

139-
func getCgroupMountsHelper(ss map[string]bool, mi io.Reader) ([]Mount, error) {
142+
func getCgroupMountsHelper(ss map[string]bool, mi io.Reader, all bool) ([]Mount, error) {
140143
res := make([]Mount, 0, len(ss))
141144
scanner := bufio.NewScanner(mi)
142145
numFound := 0
@@ -163,7 +166,9 @@ func getCgroupMountsHelper(ss map[string]bool, mi io.Reader) ([]Mount, error) {
163166
} else {
164167
m.Subsystems = append(m.Subsystems, opt)
165168
}
166-
numFound++
169+
if !all {
170+
numFound++
171+
}
167172
}
168173
res = append(res, m)
169174
}
@@ -173,23 +178,25 @@ func getCgroupMountsHelper(ss map[string]bool, mi io.Reader) ([]Mount, error) {
173178
return res, nil
174179
}
175180

176-
func GetCgroupMounts() ([]Mount, error) {
181+
// GetCgroupMounts returns the mounts for the cgroup subsystems.
182+
// all indicates whether to return just the first instance or all the mounts.
183+
func GetCgroupMounts(all bool) ([]Mount, error) {
177184
f, err := os.Open("/proc/self/mountinfo")
178185
if err != nil {
179186
return nil, err
180187
}
181188
defer f.Close()
182189

183-
all, err := ParseCgroupFile("/proc/self/cgroup")
190+
allSubsystems, err := ParseCgroupFile("/proc/self/cgroup")
184191
if err != nil {
185192
return nil, err
186193
}
187194

188195
allMap := make(map[string]bool)
189-
for s := range all {
196+
for s := range allSubsystems {
190197
allMap[s] = true
191198
}
192-
return getCgroupMountsHelper(allMap, f)
199+
return getCgroupMountsHelper(allMap, f, all)
193200
}
194201

195202
// GetAllSubsystems returns all the cgroup subsystems supported by the kernel
@@ -239,7 +246,7 @@ func GetInitCgroupDir(subsystem string) (string, error) {
239246
}
240247

241248
func readProcsFile(dir string) ([]int, error) {
242-
f, err := os.Open(filepath.Join(dir, "cgroup.procs"))
249+
f, err := os.Open(filepath.Join(dir, CgroupProcesses))
243250
if err != nil {
244251
return nil, err
245252
}
@@ -326,8 +333,7 @@ func PathExists(path string) bool {
326333
func EnterPid(cgroupPaths map[string]string, pid int) error {
327334
for _, path := range cgroupPaths {
328335
if PathExists(path) {
329-
if err := ioutil.WriteFile(filepath.Join(path, "cgroup.procs"),
330-
[]byte(strconv.Itoa(pid)), 0700); err != nil {
336+
if err := WriteCgroupProc(path, pid); err != nil {
331337
return err
332338
}
333339
}
@@ -396,7 +402,7 @@ func GetAllPids(path string) ([]int, error) {
396402
// collect pids from all sub-cgroups
397403
err := filepath.Walk(path, func(p string, info os.FileInfo, iErr error) error {
398404
dir, file := filepath.Split(p)
399-
if file != "cgroup.procs" {
405+
if file != CgroupProcesses {
400406
return nil
401407
}
402408
if iErr != nil {
@@ -411,3 +417,20 @@ func GetAllPids(path string) ([]int, error) {
411417
})
412418
return pids, err
413419
}
420+
421+
// WriteCgroupProc writes the specified pid into the cgroup's cgroup.procs file
422+
func WriteCgroupProc(dir string, pid int) error {
423+
// Normally dir should not be empty, one case is that cgroup subsystem
424+
// is not mounted, we will get empty dir, and we want it fail here.
425+
if dir == "" {
426+
return fmt.Errorf("no such directory for %s", CgroupProcesses)
427+
}
428+
429+
// Dont attach any pid to the cgroup if -1 is specified as a pid
430+
if pid != -1 {
431+
if err := ioutil.WriteFile(filepath.Join(dir, CgroupProcesses), []byte(strconv.Itoa(pid)), 0700); err != nil {
432+
return fmt.Errorf("failed to write %v to %v: %v", pid, CgroupProcesses, err)
433+
}
434+
}
435+
return nil
436+
}

vendor/src/github.com/opencontainers/runc/libcontainer/configs/cgroup_unix.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type Cgroup struct {
3636
type Resources struct {
3737
// If this is true allow access to any kind of device within the container. If false, allow access only to devices explicitly listed in the allowed_devices list.
3838
// Deprecated
39-
AllowAllDevices bool `json:"allow_all_devices,omitempty"`
39+
AllowAllDevices *bool `json:"allow_all_devices,omitempty"`
4040
// Deprecated
4141
AllowedDevices []*Device `json:"allowed_devices,omitempty"`
4242
// Deprecated
@@ -69,10 +69,10 @@ type Resources struct {
6969
CpuPeriod int64 `json:"cpu_period"`
7070

7171
// How many time CPU will use in realtime scheduling (in usecs).
72-
CpuRtRuntime int64 `json:"cpu_quota"`
72+
CpuRtRuntime int64 `json:"cpu_rt_quota"`
7373

7474
// CPU period to be used for realtime scheduling (in usecs).
75-
CpuRtPeriod int64 `json:"cpu_period"`
75+
CpuRtPeriod int64 `json:"cpu_rt_period"`
7676

7777
// CPU to use
7878
CpusetCpus string `json:"cpuset_cpus"`
@@ -120,5 +120,5 @@ type Resources struct {
120120
NetPrioIfpriomap []*IfPrioMap `json:"net_prio_ifpriomap"`
121121

122122
// Set class identifier for container's network packets
123-
NetClsClassid string `json:"net_cls_classid"`
123+
NetClsClassid uint32 `json:"net_cls_classid_u"`
124124
}

vendor/src/github.com/opencontainers/runc/libcontainer/configs/config.go

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,6 @@ type Config struct {
148148
// More information about kernel oom score calculation here: https://lwn.net/Articles/317814/
149149
OomScoreAdj int `json:"oom_score_adj"`
150150

151-
// AdditionalGroups specifies the gids that should be added to supplementary groups
152-
// in addition to those that the user belongs to.
153-
AdditionalGroups []string `json:"additional_groups"`
154-
155151
// UidMappings is an array of User ID mappings for User Namespaces
156152
UidMappings []IDMap `json:"uid_mappings"`
157153

@@ -304,29 +300,38 @@ func (c Command) Run(s HookState) error {
304300
if err != nil {
305301
return err
306302
}
303+
var stdout, stderr bytes.Buffer
307304
cmd := exec.Cmd{
308-
Path: c.Path,
309-
Args: c.Args,
310-
Env: c.Env,
311-
Stdin: bytes.NewReader(b),
305+
Path: c.Path,
306+
Args: c.Args,
307+
Env: c.Env,
308+
Stdin: bytes.NewReader(b),
309+
Stdout: &stdout,
310+
Stderr: &stderr,
311+
}
312+
if err := cmd.Start(); err != nil {
313+
return err
312314
}
313315
errC := make(chan error, 1)
314316
go func() {
315-
out, err := cmd.CombinedOutput()
317+
err := cmd.Wait()
316318
if err != nil {
317-
err = fmt.Errorf("%s: %s", err, out)
319+
err = fmt.Errorf("error running hook: %v, stdout: %s, stderr: %s", err, stdout.String(), stderr.String())
318320
}
319321
errC <- err
320322
}()
323+
var timerCh <-chan time.Time
321324
if c.Timeout != nil {
322-
select {
323-
case err := <-errC:
324-
return err
325-
case <-time.After(*c.Timeout):
326-
cmd.Process.Kill()
327-
cmd.Wait()
328-
return fmt.Errorf("hook ran past specified timeout of %.1fs", c.Timeout.Seconds())
329-
}
325+
timer := time.NewTimer(*c.Timeout)
326+
defer timer.Stop()
327+
timerCh = timer.C
328+
}
329+
select {
330+
case err := <-errC:
331+
return err
332+
case <-timerCh:
333+
cmd.Process.Kill()
334+
cmd.Wait()
335+
return fmt.Errorf("hook ran past specified timeout of %.1fs", c.Timeout.Seconds())
330336
}
331-
return <-errC
332337
}

vendor/src/github.com/opencontainers/runc/libcontainer/configs/device_defaults.go

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,5 @@ var (
107107
Permissions: "rwm",
108108
},
109109
}, DefaultSimpleDevices...)
110-
DefaultAutoCreatedDevices = append([]*Device{
111-
{
112-
// /dev/fuse is created but not allowed.
113-
// This is to allow java to work. Because java
114-
// Insists on there being a /dev/fuse
115-
// https://github.com/docker/docker/issues/514
116-
// https://github.com/docker/docker/issues/2393
117-
//
118-
Path: "/dev/fuse",
119-
Type: 'c',
120-
Major: 10,
121-
Minor: 229,
122-
Permissions: "rwm",
123-
},
124-
}, DefaultSimpleDevices...)
110+
DefaultAutoCreatedDevices = append([]*Device{}, DefaultSimpleDevices...)
125111
)

vendor/src/github.com/opencontainers/runc/libcontainer/label/label_selinux.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,18 @@ func Relabel(path string, fileLabel string, shared bool) error {
129129

130130
exclude_paths := map[string]bool{"/": true, "/usr": true, "/etc": true}
131131
if exclude_paths[path] {
132-
return fmt.Errorf("Relabeling of %s is not allowed", path)
132+
return fmt.Errorf("SELinux relabeling of %s is not allowed", path)
133133
}
134134

135135
if shared {
136136
c := selinux.NewContext(fileLabel)
137137
c["level"] = "s0"
138138
fileLabel = c.Get()
139139
}
140-
return selinux.Chcon(path, fileLabel, true)
140+
if err := selinux.Chcon(path, fileLabel, true); err != nil {
141+
return fmt.Errorf("SELinux relabeling of %s is not allowed: %q", path, err)
142+
}
143+
return nil
141144
}
142145

143146
// GetPidLabel will return the label of the process running with the specified pid

vendor/src/github.com/opencontainers/runc/libcontainer/system/syscall_linux_386.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
// Setuid sets the uid of the calling thread to the specified uid.
1010
func Setuid(uid int) (err error) {
11-
_, _, e1 := syscall.RawSyscall(syscall.SYS_SETUID, uintptr(uid), 0, 0)
11+
_, _, e1 := syscall.RawSyscall(syscall.SYS_SETUID32, uintptr(uid), 0, 0)
1212
if e1 != 0 {
1313
err = e1
1414
}

0 commit comments

Comments
 (0)