Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: next release of OpenBSD requires MAP_STACK for stacks #26142

aclements opened this issue Jun 29, 2018 · 3 comments

runtime: next release of OpenBSD requires MAP_STACK for stacks #26142

aclements opened this issue Jun 29, 2018 · 3 comments


Copy link

@aclements aclements commented Jun 29, 2018

As announced in, the upcoming release of OpenBSD 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. This breaks with the current version of Go because we don't map any memory MAP_STACK.

Fixing this is somewhat tricky given how tightly we allocate stacks and that they are interwoven with heap memory. However, they're not interwoven below page granularity, so it should be possible to fix this by remapping memory whenever a span transitions to or from being used to allocate stacks.

Copy link

@gopherbot gopherbot commented Jun 29, 2018

Change mentions this issue: runtime: remap stack spans with MAP_STACK on OpenBSD

@bradfitz bradfitz added the OS-OpenBSD label Jun 29, 2018
@aclements aclements added this to the Go1.11 milestone Jun 29, 2018
@gopherbot gopherbot closed this in 955cc07 Jun 29, 2018
Copy link

@4a6f656c 4a6f656c commented Jul 9, 2018

Unfortunately this is not quite fixed - it still fails on OpenBSD -current (what will become 6.4) as soon as a new thread is created:

$ ./all.bash
Building Go cmd/dist using /home/joel/src/go1.4.
Building Go toolchain1 using /home/joel/src/go1.4.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
go tool dist: FAILED: /home/joel/src/go/pkg/tool/openbsd_amd64/go_bootstrap install -gcflags=all= -ldflags=all= -a -i cmd/asm cmd/cgo cmd/compile cmd/link: signal: segmentation fault (core dumped)

I'll send a change to fix this.

Copy link

@gopherbot gopherbot commented Jul 9, 2018

Change mentions this issue: runtime: correct new thread stack for openbsd MAP_STACK

@aclements aclements reopened this Jul 9, 2018
@gopherbot gopherbot closed this in 8ec35ab Jul 11, 2018
@golang golang locked and limited conversation to collaborators Jul 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants