diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-12-14 17:52:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-14 17:52:57 +0100 |
commit | c134698fa12c793a3a6af7858df7760361ae0a1d (patch) | |
tree | ca8154de42ea801f02faae4a939548e9174f28c0 | |
parent | 3b9af150ab46169eabdb3be69cec32afb9db0164 (diff) | |
parent | 65d5a2b68b52817a1cb1a6d9da5d3ee7fb3e26a3 (diff) | |
download | podman-c134698fa12c793a3a6af7858df7760361ae0a1d.tar.gz podman-c134698fa12c793a3a6af7858df7760361ae0a1d.tar.bz2 podman-c134698fa12c793a3a6af7858df7760361ae0a1d.zip |
Merge pull request #12593 from vrothberg/fix-11682
pause scope: don't use the global math/rand RNG
-rw-r--r-- | utils/utils.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/utils/utils.go b/utils/utils.go index 095370a08..241e361cd 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -11,6 +11,7 @@ import ( "strconv" "strings" "sync" + "time" "github.com/containers/common/pkg/cgroups" "github.com/containers/podman/v3/libpod/define" @@ -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 |