cgroupfs: Allow explicit "/" as initial cgroup.

PiperOrigin-RevId: 448361452
This commit is contained in:
Rahat Mahmood
2022-05-12 16:22:57 -07:00
committed by gVisor bot
parent e916e4fde3
commit 700014c960
+5 -1
View File
@@ -364,10 +364,14 @@ func (fs *filesystem) prepareInitialCgroup(ctx context.Context, vfsObj *vfs.Virt
}
ctx.Debugf("cgroupfs.FilesystemType.GetFilesystem: initial cgroup path: %v", initPathStr)
initPath := fspath.Parse(initPathStr)
if !initPath.Absolute || !initPath.HasComponents() {
if !initPath.Absolute {
ctx.Warningf("cgroupfs.FilesystemType.GetFilesystem: initial cgroup path invalid: %+v", initPath)
return linuxerr.EINVAL
}
if !initPath.HasComponents() {
// Explicit "/" as initial cgroup, nothing to do.
return nil
}
ownerCreds := auth.CredentialsFromContext(ctx).Fork()
if idata.InitialCgroup.SetOwner {