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
Closed

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

aclements opened this issue Jun 29, 2018 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-OpenBSD
Milestone

Comments

@aclements
Copy link
Member

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
Copy link

Change https://golang.org/cl/121657 mentions this issue: runtime: remap stack spans with MAP_STACK on OpenBSD

@aclements aclements added this to the Go1.11 milestone Jun 29, 2018
@4a6f656c
Copy link
Contributor

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.

@gopherbot
Copy link

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

@aclements aclements reopened this Jul 9, 2018
@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 10, 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.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-OpenBSD
Projects
None yet
Development

No branches or pull requests

5 participants