diff options
author | Michael Pratt <mpratt@google.com> | 2024-04-18 12:42:43 -0400 |
---|---|---|
committer | Michael Pratt <mpratt@google.com> | 2024-04-19 16:34:32 +0000 |
commit | 1a3682b4c1e44f334c5cc8fbad3c28b853c2aff2 (patch) | |
tree | eaa8a711a1fa890fd7ff3f201049627c5fbf9119 /src/runtime/alg.go | |
parent | 1a0b86375fad202048adb88cba4caec535a52a45 (diff) | |
download | go-1a3682b4c1e44f334c5cc8fbad3c28b853c2aff2.tar.gz go-1a3682b4c1e44f334c5cc8fbad3c28b853c2aff2.zip |
runtime: use bootstrapRand to initialize hashkey
The seed for rand is not initialized until after alginit. Before
initialization, rand returns a deterministic sequence, making hashkey
deterministic across processes.
Switch to bootstrapRand, like other early rand calls, such as
initialization of aeskeysched.
Fixes #66885.
Change-Id: I5023a9161232b49fda2ebd1d5f9338bbdd17b1fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/580136
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Diffstat (limited to 'src/runtime/alg.go')
-rw-r--r-- | src/runtime/alg.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/alg.go b/src/runtime/alg.go index f5125d414f..aadd5f1002 100644 --- a/src/runtime/alg.go +++ b/src/runtime/alg.go @@ -391,7 +391,7 @@ func alginit() { return } for i := range hashkey { - hashkey[i] = uintptr(rand()) | 1 // make sure these numbers are odd + hashkey[i] = uintptr(bootstrapRand()) | 1 // make sure these numbers are odd } } |