Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runc run/create: refuse non-empty cgroup; runc exec: refuse frozen cgroup #3131

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions contrib/cmd/sd-helper/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ func main() {
}
}

func newManager(config *configs.Cgroup) cgroups.Manager {
func newManager(config *configs.Cgroup) (cgroups.Manager, error) {
if cgroups.IsCgroup2UnifiedMode() {
return systemd.NewUnifiedManager(config, "", false)
return systemd.NewUnifiedManager(config, "")
}
return systemd.NewLegacyManager(config, nil)
}
Expand All @@ -70,7 +70,10 @@ func unitCommand(cmd, name, parent string) error {
Parent: parent,
Resources: &configs.Resources{},
}
pm := newManager(podConfig)
pm, err := newManager(podConfig)
if err != nil {
return err
}

switch cmd {
case "start":
Expand Down
4 changes: 2 additions & 2 deletions exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ func execProcess(context *cli.Context) (int, error) {
if err != nil {
return -1, err
}
if status == libcontainer.Stopped {
return -1, errors.New("cannot exec a container that has stopped")
if status == libcontainer.Stopped || status == libcontainer.Paused {
return -1, fmt.Errorf("cannot exec in a %s container", status)
}
path := context.String("process")
if path == "" && len(context.Args()) == 1 {
Expand Down
4 changes: 2 additions & 2 deletions libcontainer/cgroups/fs/blkio.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ func (s *BlkioGroup) Name() string {
return "blkio"
}

func (s *BlkioGroup) Apply(path string, d *cgroupData) error {
return join(path, d.pid)
func (s *BlkioGroup) Apply(path string, _ *configs.Resources, pid int) error {
return apply(path, pid)
}

func (s *BlkioGroup) Set(path string, r *configs.Resources) error {
Expand Down
Loading