mirror of
https://github.com/golang/go
synced 2024-11-07 14:36:17 -07:00
8174f7fb2b
Linux 5.2 introduced a bug that can corrupt vector registers on return from a signal if the signal stack isn't faulted in: https://bugzilla.kernel.org/show_bug.cgi?id=205663 This CL works around this by mlocking the top page of all Go signal stacks on the affected kernels. Fixes #35326, #35777 Change-Id: I77c80a2baa4780827633f92f464486caa222295d Reviewed-on: https://go-review.googlesource.com/c/go/+/209899 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: David Chase <drchase@google.com>
50 lines
1.4 KiB
Go
50 lines
1.4 KiB
Go
// Copyright 2009 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package runtime
|
|
|
|
import "internal/cpu"
|
|
|
|
const (
|
|
_HWCAP_VFP = 1 << 6 // introduced in at least 2.6.11
|
|
_HWCAP_VFPv3 = 1 << 13 // introduced in 2.6.30
|
|
)
|
|
|
|
func checkgoarm() {
|
|
// On Android, /proc/self/auxv might be unreadable and hwcap won't
|
|
// reflect the CPU capabilities. Assume that every Android arm device
|
|
// has the necessary floating point hardware available.
|
|
if GOOS == "android" {
|
|
return
|
|
}
|
|
if goarm > 5 && cpu.HWCap&_HWCAP_VFP == 0 {
|
|
print("runtime: this CPU has no floating point hardware, so it cannot run\n")
|
|
print("this GOARM=", goarm, " binary. Recompile using GOARM=5.\n")
|
|
exit(1)
|
|
}
|
|
if goarm > 6 && cpu.HWCap&_HWCAP_VFPv3 == 0 {
|
|
print("runtime: this CPU has no VFPv3 floating point hardware, so it cannot run\n")
|
|
print("this GOARM=", goarm, " binary. Recompile using GOARM=5 or GOARM=6.\n")
|
|
exit(1)
|
|
}
|
|
}
|
|
|
|
func archauxv(tag, val uintptr) {
|
|
switch tag {
|
|
case _AT_HWCAP:
|
|
cpu.HWCap = uint(val)
|
|
case _AT_HWCAP2:
|
|
cpu.HWCap2 = uint(val)
|
|
}
|
|
}
|
|
|
|
func osArchInit() {}
|
|
|
|
//go:nosplit
|
|
func cputicks() int64 {
|
|
// Currently cputicks() is used in blocking profiler and to seed fastrand().
|
|
// nanotime() is a poor approximation of CPU ticks that is enough for the profiler.
|
|
return nanotime()
|
|
}
|