diff options
author | Austin Clements <austin@google.com> | 2016-04-14 12:32:28 -0400 |
---|---|---|
committer | Austin Clements <austin@google.com> | 2016-04-16 21:42:31 +0000 |
commit | 90addd3d41852192ba697d33c9b1660988b82ed7 (patch) | |
tree | 92aadcb66953c0ef76751253ce9f7d708ebc843c /src/runtime/os_linux_arm.go | |
parent | c955bb2040e601c474e547b8badbe44677c9fbdf (diff) | |
download | go-90addd3d41852192ba697d33c9b1660988b82ed7.tar.gz go-90addd3d41852192ba697d33c9b1660988b82ed7.zip |
runtime: common handling of _AT_RANDOM auxv
The Linux kernel provides 16 bytes of random data via the auxv vector
at startup. Currently we consume this separately on 386, amd64, arm,
and arm64. Now that we have a common auxv parser, handle _AT_RANDOM in
the common path.
Change-Id: Ib69549a1d37e2d07a351cf0f44007bcd24f0d20d
Reviewed-on: https://go-review.googlesource.com/22062
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/runtime/os_linux_arm.go')
-rw-r--r-- | src/runtime/os_linux_arm.go | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/runtime/os_linux_arm.go b/src/runtime/os_linux_arm.go index a61be916b6..8e2765a413 100644 --- a/src/runtime/os_linux_arm.go +++ b/src/runtime/os_linux_arm.go @@ -9,7 +9,6 @@ import "unsafe" const ( _AT_PLATFORM = 15 // introduced in at least 2.6.11 _AT_HWCAP = 16 // introduced in at least 2.6.11 - _AT_RANDOM = 25 // introduced in 2.6.29 _HWCAP_VFP = 1 << 6 // introduced in at least 2.6.11 _HWCAP_VFPv3 = 1 << 13 // introduced in 2.6.30 @@ -34,10 +33,10 @@ func checkgoarm() { func archauxv(tag, val uintptr) { switch tag { - case _AT_RANDOM: // kernel provides a pointer to 16-bytes worth of random data - startupRandomData = (*[16]byte)(unsafe.Pointer(val))[:] - // the pointer provided may not be word aligned, so we must treat it - // as a byte array. + 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 |