aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/os_nonopenbsd.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2018-06-29 14:56:48 -0400
committerAustin Clements <austin@google.com>2018-06-29 21:27:23 +0000
commit955cc07dde70415489fb2096eb575654181e21fe (patch)
tree9f4380ee615b06c0bf48aa5b893301a80b1e3c9e /src/runtime/os_nonopenbsd.go
parenta94a390e5cf802e54c95afb973c2f51be76f669e (diff)
downloadgo-955cc07dde70415489fb2096eb575654181e21fe.tar.gz
go-955cc07dde70415489fb2096eb575654181e21fe.zip
runtime: remap stack spans with MAP_STACK on OpenBSD
OpenBSD 6.4 is going to start requiring that the SP points to memory that was mapped with MAP_STACK on system call entry, traps, and when switching to the alternate signal stack [1]. Currently, Go doesn't map any memory MAP_STACK, so the kernel quickly kills Go processes. Fix this by remapping the memory that backs stack spans with MAP_STACK, and re-remapping it without MAP_STACK when it's returned to the heap. [1] http://openbsd-archive.7691.n7.nabble.com/stack-register-checking-td338238.html Fixes #26142. Change-Id: I656eb84385a22833445d49328bb304f8cdd0e225 Reviewed-on: https://go-review.googlesource.com/121657 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/runtime/os_nonopenbsd.go')
-rw-r--r--src/runtime/os_nonopenbsd.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/runtime/os_nonopenbsd.go b/src/runtime/os_nonopenbsd.go
new file mode 100644
index 0000000000..e65697bdb3
--- /dev/null
+++ b/src/runtime/os_nonopenbsd.go
@@ -0,0 +1,17 @@
+// Copyright 2018 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.
+
+// +build !openbsd
+
+package runtime
+
+// osStackAlloc performs OS-specific initialization before s is used
+// as stack memory.
+func osStackAlloc(s *mspan) {
+}
+
+// osStackFree undoes the effect of osStackAlloc before s is returned
+// to the heap.
+func osStackFree(s *mspan) {
+}