]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: get randomness from AT_RANDOM AUXV on linux/mips64x
authorShenghou Ma <minux@golang.org>
Fri, 6 May 2016 04:53:42 +0000 (00:53 -0400)
committerMinux Ma <minux@golang.org>
Fri, 6 May 2016 05:50:02 +0000 (05:50 +0000)
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>

src/runtime/os_linux_mips64x.go
src/runtime/os_linux_noauxv.go

index 92b5c82af7c20fa9e125c835eb66b0be0d2ee589..8039b2fac9b7a34de683d8dd41e9b20df7e8b51f 100644 (file)
@@ -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().
index 0b46f594ce011765737839ebe899e7639cd6032c..22522dd803dc02704b9e27c91c1bd9027689a5d0 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build !amd64,!arm,!arm64
+// +build !amd64,!arm,!arm64,!mips64,!mips64le
 
 package runtime