Skip to content

Commit

Permalink
The state.json should be generated prior to the creation of the cgroup.
Browse files Browse the repository at this point in the history
  • Loading branch information
jianghao65536 committed Nov 18, 2024
1 parent b7da167 commit 2026161
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libcontainer/process_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,13 @@ func (p *initProcess) start() (retErr error) {
}
}()

// A SIGKILL can happen at any time, and without the state.json,
// the 'runc delete --force' command won't be able to clear the cgroup.
_, err = p.container.updateState(p)
if err != nil {
return fmt.Errorf("unable to store init state: %w", err)
}

// Do this before syncing with child so that no children can escape the
// cgroup. We don't need to worry about not doing this and not being root
// because we'd be using the rootless cgroup manager in that case.
Expand Down

0 comments on commit 2026161

Please sign in to comment.