]> Cypherpunks repositories - gostls13.git/commit
runtime: remap stack spans with MAP_STACK on OpenBSD
authorAustin Clements <austin@google.com>
Fri, 29 Jun 2018 18:56:48 +0000 (14:56 -0400)
committerAustin Clements <austin@google.com>
Fri, 29 Jun 2018 21:27:23 +0000 (21:27 +0000)
commit955cc07dde70415489fb2096eb575654181e21fe
tree9f4380ee615b06c0bf48aa5b893301a80b1e3c9e
parenta94a390e5cf802e54c95afb973c2f51be76f669e
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>
src/runtime/defs_openbsd.go
src/runtime/defs_openbsd_386.go
src/runtime/defs_openbsd_amd64.go
src/runtime/defs_openbsd_arm.go
src/runtime/os_nonopenbsd.go [new file with mode: 0644]
src/runtime/os_openbsd.go
src/runtime/stack.go