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 <smirnov.andrey@gmail.com>
This commit is contained in:
Andrey Smirnov
2019-07-18 01:08:52 +03:00
parent aee28f4deb
commit 0abd2ca506

View File

@@ -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"}
}
}
}