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

Closed
aclements opened this issue Jun 29, 2018 · 3 comments

Comments

Projects
None yet
5 participants
@aclements
Copy link
Member

commented Jun 29, 2018

As announced in http://openbsd-archive.7691.n7.nabble.com/stack-register-checking-td338238.html, 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.

@gopherbot

This comment has been minimized.

Copy link

commented Jun 29, 2018

Change https://golang.org/cl/121657 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

@4a6f656c

This comment has been minimized.

Copy link
Contributor

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.

@gopherbot

This comment has been minimized.

Copy link

commented Jul 9, 2018

Change https://golang.org/cl/122735 mentions this issue: runtime: correct new thread stack for openbsd MAP_STACK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.