From 0abd2ca50660cd3e02404aa66da73408b60b4c1b Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 18 Jul 2019 01:08:52 +0300 Subject: [PATCH] Fix updating /sys/fs/cgroup mount to 'rw' There were two bugs: Mount was matched by Type which is actually `cgroup`, not `sysfs`. And the second problem was that copy of the value was modified, not value in the slice. Signed-off-by: Andrey Smirnov --- executor/oci/spec_unix.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/executor/oci/spec_unix.go b/executor/oci/spec_unix.go index fb4f34a43..cfd102d9a 100644 --- a/executor/oci/spec_unix.go +++ b/executor/oci/spec_unix.go @@ -102,9 +102,9 @@ func GenerateSpec(ctx context.Context, meta executor.Meta, mounts []executor.Mou if meta.SecurityMode == pb.SecurityMode_INSECURE { //make sysfs rw mount for insecure mode. - for _, m := range s.Mounts { - if m.Type == "sysfs" { - m.Options = []string{"nosuid", "noexec", "nodev", "rw"} + for i, m := range s.Mounts { + if m.Destination == "/sys/fs/cgroup" { + s.Mounts[i].Options = []string{"nosuid", "noexec", "nodev", "rw"} } } }