Skip to content

Commit

Permalink
Merge pull request #12593 from vrothberg/fix-11682
Browse files Browse the repository at this point in the history
pause scope: don't use the global math/rand RNG
  • Loading branch information
openshift-merge-robot authored Dec 14, 2021
2 parents 3b9af15 + 65d5a2b commit c134698
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"strconv"
"strings"
"sync"
"time"

"github.com/containers/common/pkg/cgroups"
"github.com/containers/podman/v3/libpod/define"
Expand Down Expand Up @@ -204,8 +205,9 @@ func moveProcessToScope(pidPath, slice, scope string) error {
func MovePauseProcessToScope(pausePidPath string) {
var err error

for i := 0; i < 3; i++ {
r := rand.Int()
state := rand.New(rand.NewSource(time.Now().UnixNano()))
for i := 0; i < 10; i++ {
r := state.Int()
err = moveProcessToScope(pausePidPath, "user.slice", fmt.Sprintf("podman-pause-%d.scope", r))
if err == nil {
return
Expand Down

0 comments on commit c134698

Please sign in to comment.