Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
(cherry picked from commit b675124cf5fc96a6c329b5580ef60304089270c6)
| ... | ... |
@@ -233,10 +233,10 @@ RUN set -x \ |
| 233 | 233 |
&& rm -rf "$GOPATH" |
| 234 | 234 |
|
| 235 | 235 |
# Install runc |
| 236 |
-ENV RUNC_COMMIT 5ce88a95f6cf218ba7f3309562f95464a968e890 |
|
| 236 |
+ENV RUNC_COMMIT cc29e3dded8e27ba8f65738f40d251c885030a28 |
|
| 237 | 237 |
RUN set -x \ |
| 238 | 238 |
&& export GOPATH="$(mktemp -d)" \ |
| 239 |
- && git clone https://github.com/crosbymichael/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ |
|
| 239 |
+ && git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ |
|
| 240 | 240 |
&& cd "$GOPATH/src/github.com/opencontainers/runc" \ |
| 241 | 241 |
&& git checkout -q "$RUNC_COMMIT" \ |
| 242 | 242 |
&& make static BUILDTAGS="seccomp apparmor selinux" \ |
| ... | ... |
@@ -180,10 +180,10 @@ RUN set -x \ |
| 180 | 180 |
&& rm -rf "$GOPATH" |
| 181 | 181 |
|
| 182 | 182 |
# Install runc |
| 183 |
-ENV RUNC_COMMIT 5ce88a95f6cf218ba7f3309562f95464a968e890 |
|
| 183 |
+ENV RUNC_COMMIT cc29e3dded8e27ba8f65738f40d251c885030a28 |
|
| 184 | 184 |
RUN set -x \ |
| 185 | 185 |
&& export GOPATH="$(mktemp -d)" \ |
| 186 |
- && git clone https://github.com/crosbymichael/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ |
|
| 186 |
+ && git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ |
|
| 187 | 187 |
&& cd "$GOPATH/src/github.com/opencontainers/runc" \ |
| 188 | 188 |
&& git checkout -q "$RUNC_COMMIT" \ |
| 189 | 189 |
&& make static BUILDTAGS="seccomp apparmor selinux" \ |
| ... | ... |
@@ -189,10 +189,10 @@ RUN set -x \ |
| 189 | 189 |
&& rm -rf "$GOPATH" |
| 190 | 190 |
|
| 191 | 191 |
# Install runc |
| 192 |
-ENV RUNC_COMMIT 5ce88a95f6cf218ba7f3309562f95464a968e890 |
|
| 192 |
+ENV RUNC_COMMIT cc29e3dded8e27ba8f65738f40d251c885030a28 |
|
| 193 | 193 |
RUN set -x \ |
| 194 | 194 |
&& export GOPATH="$(mktemp -d)" \ |
| 195 |
- && git clone https://github.com/crosbymichael/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ |
|
| 195 |
+ && git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ |
|
| 196 | 196 |
&& cd "$GOPATH/src/github.com/opencontainers/runc" \ |
| 197 | 197 |
&& git checkout -q "$RUNC_COMMIT" \ |
| 198 | 198 |
&& make static BUILDTAGS="seccomp apparmor selinux" \ |
| ... | ... |
@@ -74,10 +74,10 @@ WORKDIR /go/src/github.com/docker/docker |
| 74 | 74 |
ENV DOCKER_BUILDTAGS apparmor seccomp selinux |
| 75 | 75 |
|
| 76 | 76 |
# Install runc |
| 77 |
-ENV RUNC_COMMIT 5ce88a95f6cf218ba7f3309562f95464a968e890 |
|
| 77 |
+ENV RUNC_COMMIT cc29e3dded8e27ba8f65738f40d251c885030a28 |
|
| 78 | 78 |
RUN set -x \ |
| 79 | 79 |
&& export GOPATH="$(mktemp -d)" \ |
| 80 |
- && git clone https://github.com/crosbymichael/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ |
|
| 80 |
+ && git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ |
|
| 81 | 81 |
&& cd "$GOPATH/src/github.com/opencontainers/runc" \ |
| 82 | 82 |
&& git checkout -q "$RUNC_COMMIT" \ |
| 83 | 83 |
&& make static BUILDTAGS="seccomp apparmor selinux" \ |
| ... | ... |
@@ -204,10 +204,10 @@ RUN set -x \ |
| 204 | 204 |
&& rm -rf "$GOPATH" |
| 205 | 205 |
|
| 206 | 206 |
# Install runc |
| 207 |
-ENV RUNC_COMMIT 5ce88a95f6cf218ba7f3309562f95464a968e890 |
|
| 207 |
+ENV RUNC_COMMIT cc29e3dded8e27ba8f65738f40d251c885030a28 |
|
| 208 | 208 |
RUN set -x \ |
| 209 | 209 |
&& export GOPATH="$(mktemp -d)" \ |
| 210 |
- && git clone https://github.com/crosbymichael/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ |
|
| 210 |
+ && git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ |
|
| 211 | 211 |
&& cd "$GOPATH/src/github.com/opencontainers/runc" \ |
| 212 | 212 |
&& git checkout -q "$RUNC_COMMIT" \ |
| 213 | 213 |
&& make static BUILDTAGS="apparmor seccomp selinux" \ |
| ... | ... |
@@ -197,10 +197,10 @@ RUN set -x \ |
| 197 | 197 |
&& rm -rf "$GOPATH" |
| 198 | 198 |
|
| 199 | 199 |
# Install runc |
| 200 |
-ENV RUNC_COMMIT 5ce88a95f6cf218ba7f3309562f95464a968e890 |
|
| 200 |
+ENV RUNC_COMMIT cc29e3dded8e27ba8f65738f40d251c885030a28 |
|
| 201 | 201 |
RUN set -x \ |
| 202 | 202 |
&& export GOPATH="$(mktemp -d)" \ |
| 203 |
- && git clone https://github.com/crosbymichael/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ |
|
| 203 |
+ && git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ |
|
| 204 | 204 |
&& cd "$GOPATH/src/github.com/opencontainers/runc" \ |
| 205 | 205 |
&& git checkout -q "$RUNC_COMMIT" \ |
| 206 | 206 |
&& make static BUILDTAGS="seccomp apparmor selinux" \ |
| ... | ... |
@@ -57,10 +57,10 @@ ENV GOPATH /go:/go/src/github.com/docker/docker/vendor |
| 57 | 57 |
ENV CGO_LDFLAGS -L/lib |
| 58 | 58 |
|
| 59 | 59 |
# Install runc |
| 60 |
-ENV RUNC_COMMIT 5ce88a95f6cf218ba7f3309562f95464a968e890 |
|
| 60 |
+ENV RUNC_COMMIT cc29e3dded8e27ba8f65738f40d251c885030a28 |
|
| 61 | 61 |
RUN set -x \ |
| 62 | 62 |
&& export GOPATH="$(mktemp -d)" \ |
| 63 |
- && git clone https://github.com/crosbymichael/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ |
|
| 63 |
+ && git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ |
|
| 64 | 64 |
&& cd "$GOPATH/src/github.com/opencontainers/runc" \ |
| 65 | 65 |
&& git checkout -q "$RUNC_COMMIT" \ |
| 66 | 66 |
&& make static BUILDTAGS="seccomp apparmor selinux" \ |
| ... | ... |
@@ -102,7 +102,7 @@ clone git github.com/miekg/pkcs11 df8ae6ca730422dba20c768ff38ef7d79077a59f |
| 102 | 102 |
clone git github.com/docker/go v1.5.1-1-1-gbaf439e |
| 103 | 103 |
clone git github.com/agl/ed25519 d2b94fd789ea21d12fac1a4443dd3a3f79cda72c |
| 104 | 104 |
|
| 105 |
-clone git github.com/opencontainers/runc 85873d917e86676e44ccb80719fcb47a794676a1 # libcontainer |
|
| 105 |
+clone git github.com/opencontainers/runc cc29e3dded8e27ba8f65738f40d251c885030a28 # libcontainer |
|
| 106 | 106 |
clone git github.com/opencontainers/specs v1.0.0-rc1 # specs |
| 107 | 107 |
clone git github.com/seccomp/libseccomp-golang 32f571b70023028bd57d9288c20efbcb237f3ce0 |
| 108 | 108 |
# libcontainer deps (see src/github.com/opencontainers/runc/Godeps/Godeps.json) |
| ... | ... |
@@ -262,6 +262,8 @@ func readProcsFile(dir string) ([]int, error) {
|
| 262 | 262 |
return out, nil |
| 263 | 263 |
} |
| 264 | 264 |
|
| 265 |
+// ParseCgroupFile parses the given cgroup file, typically from |
|
| 266 |
+// /proc/<pid>/cgroup, into a map of subgroups to cgroup names. |
|
| 265 | 267 |
func ParseCgroupFile(path string) (map[string]string, error) {
|
| 266 | 268 |
f, err := os.Open(path) |
| 267 | 269 |
if err != nil {
|
| ... | ... |
@@ -269,7 +271,12 @@ func ParseCgroupFile(path string) (map[string]string, error) {
|
| 269 | 269 |
} |
| 270 | 270 |
defer f.Close() |
| 271 | 271 |
|
| 272 |
- s := bufio.NewScanner(f) |
|
| 272 |
+ return parseCgroupFromReader(f) |
|
| 273 |
+} |
|
| 274 |
+ |
|
| 275 |
+// helper function for ParseCgroupFile to make testing easier |
|
| 276 |
+func parseCgroupFromReader(r io.Reader) (map[string]string, error) {
|
|
| 277 |
+ s := bufio.NewScanner(r) |
|
| 273 | 278 |
cgroups := make(map[string]string) |
| 274 | 279 |
|
| 275 | 280 |
for s.Scan() {
|
| ... | ... |
@@ -278,7 +285,16 @@ func ParseCgroupFile(path string) (map[string]string, error) {
|
| 278 | 278 |
} |
| 279 | 279 |
|
| 280 | 280 |
text := s.Text() |
| 281 |
- parts := strings.Split(text, ":") |
|
| 281 |
+ // from cgroups(7): |
|
| 282 |
+ // /proc/[pid]/cgroup |
|
| 283 |
+ // ... |
|
| 284 |
+ // For each cgroup hierarchy ... there is one entry |
|
| 285 |
+ // containing three colon-separated fields of the form: |
|
| 286 |
+ // hierarchy-ID:subsystem-list:cgroup-path |
|
| 287 |
+ parts := strings.SplitN(text, ":", 3) |
|
| 288 |
+ if len(parts) < 3 {
|
|
| 289 |
+ return nil, fmt.Errorf("invalid cgroup entry: must contain at least two colons: %v", text)
|
|
| 290 |
+ } |
|
| 282 | 291 |
|
| 283 | 292 |
for _, subs := range strings.Split(parts[1], ",") {
|
| 284 | 293 |
cgroups[subs] = parts[2] |