diff options
author | Shenghou Ma <minux@golang.org> | 2016-05-06 00:53:42 -0400 |
---|---|---|
committer | Minux Ma <minux@golang.org> | 2016-05-06 05:50:02 +0000 |
commit | 2e32efc44ac86cce3bd0808e6049d8c9b0225ba8 (patch) | |
tree | 48325f0bf77d888645e021fea6e6b0ba0624e6b9 /src/runtime/os_linux_mips64x.go | |
parent | ef92857e27556804d66e72e2360dc2c6b6554bd7 (diff) | |
download | go-2e32efc44ac86cce3bd0808e6049d8c9b0225ba8.tar.gz go-2e32efc44ac86cce3bd0808e6049d8c9b0225ba8.zip |
runtime: get randomness from AT_RANDOM AUXV on linux/mips64x
Fixes #15148.
Change-Id: If3b628f30521adeec1625689dbc98aaf4a9ec858
Reviewed-on: https://go-review.googlesource.com/22811
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/os_linux_mips64x.go')
-rw-r--r-- | src/runtime/os_linux_mips64x.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/runtime/os_linux_mips64x.go b/src/runtime/os_linux_mips64x.go index 92b5c82af7..8039b2fac9 100644 --- a/src/runtime/os_linux_mips64x.go +++ b/src/runtime/os_linux_mips64x.go @@ -9,6 +9,17 @@ package runtime var randomNumber uint32 +func archauxv(tag, val uintptr) { + switch tag { + case _AT_RANDOM: + // sysargs filled in startupRandomData, but that + // pointer may not be word aligned, so we must treat + // it as a byte array. + randomNumber = uint32(startupRandomData[4]) | uint32(startupRandomData[5])<<8 | + uint32(startupRandomData[6])<<16 | uint32(startupRandomData[7])<<24 + } +} + //go:nosplit func cputicks() int64 { // Currently cputicks() is used in blocking profiler and to seed fastrand1(). |