diff options
author | Austin Clements <austin@google.com> | 2018-06-29 14:56:48 -0400 |
---|---|---|
committer | Austin Clements <austin@google.com> | 2018-06-29 21:27:23 +0000 |
commit | 955cc07dde70415489fb2096eb575654181e21fe (patch) | |
tree | 9f4380ee615b06c0bf48aa5b893301a80b1e3c9e /src/runtime/defs_openbsd_arm.go | |
parent | a94a390e5cf802e54c95afb973c2f51be76f669e (diff) | |
download | go-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/defs_openbsd_arm.go')
-rw-r--r-- | src/runtime/defs_openbsd_arm.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/runtime/defs_openbsd_arm.go b/src/runtime/defs_openbsd_arm.go index 38b77c92d0..1eea9ad45a 100644 --- a/src/runtime/defs_openbsd_arm.go +++ b/src/runtime/defs_openbsd_arm.go @@ -17,6 +17,7 @@ const ( _MAP_ANON = 0x1000 _MAP_PRIVATE = 0x2 _MAP_FIXED = 0x10 + _MAP_STACK = 0x4000 _MADV_FREE = 0x6 |