Skip to content

Commit

Permalink
daemon: use OwnCgroupPath in withCgroups
Browse files Browse the repository at this point in the history
Note: this usage comes from commit 56f77d5 (part of PR 23430).

cgroups.InitCgroupPath is removed from runc (see [1]), and it is
suggested that users use OwnCgroupPath instead, because using init's is
problematic when in host PID namespace (see [2]) and is generally not
the right thing to do (see [3]).

[1]: opencontainers/runc@fd5debf3
[2]: opencontainers/runc@2b28b3c2
[3]: opencontainers/runc@54e20217

Signed-off-by: Kir Kolyshkin <[email protected]>
  • Loading branch information
kolyshkin committed Oct 23, 2024
1 parent 7f8ef5c commit 6be2074
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions daemon/oci_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -829,15 +829,11 @@ func withCgroups(daemon *Daemon, daemonCfg *dconfig.Config, c *container.Contain

p := cgroupsPath
if useSystemd {
initPath, err := cgroups.GetInitCgroup("cpu")
path, err := cgroups.GetOwnCgroup("cpu")
if err != nil {
return errors.Wrap(err, "unable to init CPU RT controller")
}
_, err = cgroups.GetOwnCgroup("cpu")
if err != nil {
return errors.Wrap(err, "unable to init CPU RT controller")
}
p = filepath.Join(initPath, s.Linux.CgroupsPath)
p = filepath.Join(path, s.Linux.CgroupsPath)
}

// Clean path to guard against things like ../../../BAD
Expand Down

0 comments on commit 6be2074

Please sign in to comment.