aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sys_openbsd1.go
AgeCommit message (Collapse)Author
2021-11-30runtime: keep //go:cgo_unsafe_args arguments alive to prevent GCJason A. Donenfeld
When syscall's DLL.FindProc calls into syscall_getprocaddress with a byte slice pointer, we need to keep those bytes alive. Otherwise the GC will collect the allocation, and we wind up calling `GetProcAddress` on garbage, which showed up as various flakes in the builders. It turns out that this problem extends to many uses of //go:cgo_unsafe_args throughout, on all platforms. So this patch fixes the issue by keeping non-integer pointer arguments alive through their invocation in //go:cgo_unsafe_args functions. Fixes #49731. Change-Id: I93e4fbc2e8e210cb3fc53149708758bb33f2f9c7 Reviewed-on: https://go-review.googlesource.com/c/go/+/367654 Trust: Jason A. Donenfeld <Jason@zx2c4.com> Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Patrik Nyblom <pnyb@google.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-10-28all: go fix -fix=buildtag std cmd (except for bootstrap deps, vendor)Russ Cox
When these packages are released as part of Go 1.18, Go 1.16 will no longer be supported, so we can remove the +build tags in these files. Ran go fix -fix=buildtag std cmd and then reverted the bootstrapDirs as defined in src/cmd/dist/buildtool.go, which need to continue to build with Go 1.4 for now. Also reverted src/vendor and src/cmd/vendor, which will need to be updated in their own repos first. Manual changes in runtime/pprof/mprof_test.go to adjust line numbers. For #41184. Change-Id: Ic0f93f7091295b6abc76ed5cd6e6746e1280861e Reviewed-on: https://go-review.googlesource.com/c/go/+/344955 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-05-18[dev.typeparams] runtime: use internal/abi.FuncPCABI0 for syscall wrappers ↵Cherry Mui
on OpenBSD Same as CL 313230, for OpenBSD. Change-Id: I56f4a8a368e1a17615a01db4e2b6c53e4ed263bd Reviewed-on: https://go-review.googlesource.com/c/go/+/320889 Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2021-05-14runtime: mark osyield nosplit on OpenBSDCherry Mui
osyield is called in code paths that are not allowed to split stack, e.g. casgstatus called from entersyscall/exitsyscall. It is nosplit on all other platforms. Mark it nosplit on OpenBSD as well. Change-Id: I3fed5d7f58b3d50610beca6eed2c7e902b8ec52c Reviewed-on: https://go-review.googlesource.com/c/go/+/319969 Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Joel Sing <joel@sing.id.au>
2021-05-11runtime,syscall: simplify openbsd related build tagsJoel Sing
openbsd/mips64 is now the only openbsd port that uses non-libc syscall - revise build tags to reflect this. Update #36435 Change-Id: I357b2dd2926d058e25e618fcca42c388587598a8 Reviewed-on: https://go-review.googlesource.com/c/go/+/317919 Trust: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-05-09runtime: switch openbsd/arm locking to libcJoel Sing
Switch openbsd/arm to locking via libc, rather than performing direct system calls. Update #36435 Change-Id: I190abb1aa544d2cb406fe412960ec106c9716f87 Reviewed-on: https://go-review.googlesource.com/c/go/+/315791 Trust: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-04-30runtime: switch openbsd/386 locking to libcJoel Sing
Switch openbsd/386 to locking via libc, rather than performing direct system calls. Update #36435 Change-Id: I8198171e21f9acf28846ad723ea9ff48f7c8a69d Reviewed-on: https://go-review.googlesource.com/c/go/+/287652 Trust: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-02-20all: go fmt std cmd (but revert vendor)Russ Cox
Make all our package sources use Go 1.17 gofmt format (adding //go:build lines). Part of //go:build change (#41184). See https://golang.org/design/draft-gobuild Change-Id: Ia0534360e4957e58cd9a18429c39d0e32a6addb4 Reviewed-on: https://go-review.googlesource.com/c/go/+/294430 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-02-19runtime: clean up system calls during cgo callback initRuss Cox
During a cgocallback, the runtime calls needm to get an m. The calls made during needm cannot themselves assume that there is an m or a g (which is attached to the m). In the old days of making direct system calls, the only thing you had to do for such functions was mark them //go:nosplit, to avoid the use of g in the stack split prologue. But now, on operating systems that make system calls through shared libraries and use code that saves state in the g or m before doing so, it's not safe to assume g exists. In fact, it is not even safe to call getg(), because it might fault deferencing the TLS storage to find the g pointer (that storage may not be initialized yet, at least on Windows, and perhaps on other systems in the future). The specific routines that are problematic are usleep and osyield, which are called during lock contention in lockextra, called from needm. All this is rather subtle and hidden, so in addition to fixing the problem on Windows, this CL makes the fact of not running on a g much clearer by introducing variants usleep_no_g and osyield_no_g whose names should make clear that there is no g. And then we can remove the various sketchy getg() == nil checks in the existing routines. As part of this cleanup, this CL also deletes onosstack on Windows. onosstack is from back when the runtime was implemented in C. It predates systemstack but does essentially the same thing. Instead of having two different copies of this code, we can use systemstack consistently. This way we need not port onosstack to each architecture. This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. This CL is, however, not windows/arm64-specific. It is cleanup meant to make the port (and future ports) easier. Change-Id: I3352de1fd0a3c26267c6e209063e6e86abd26187 Reviewed-on: https://go-review.googlesource.com/c/go/+/288793 Trust: Russ Cox <rsc@golang.org> Trust: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-01-27runtime: convert openbsd/arm64 locking to libcJoel Sing
Switch openbsd/arm64 to locking via libc, rather than performing direct system calls. Update #36435 Change-Id: I2f30432c4bc232224cf87dca750665b8c40c7b72 Reviewed-on: https://go-review.googlesource.com/c/go/+/286813 Trust: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-01-20runtime: convert openbsd/amd64 locking to libcJoel Sing
Switch openbsd/amd64 to locking via libc, rather than performing direct system calls. Update #36435 Change-Id: I5e92bd70ce557b78ff385577088a9775cc468ea9 Reviewed-on: https://go-review.googlesource.com/c/go/+/270378 Trust: Joel Sing <joel@sing.id.au> Run-TryBot: Joel Sing <joel@sing.id.au> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>