aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/cgo_sigaction.go
AgeCommit message (Collapse)Author
2021-05-10runtime/cgo,cmd/internal/obj/ppc64: fix signals with cgoLynn Boger
Recently some tsan tests were enabled on ppc64le which had not been enabled before. This resulted in failures on systems with tsan available, and while debugging it was determined that there were other issues related to the use of signals with cgo. Signals were not being forwarded within programs linked against libtsan because the nocgo sigaction was being called for ppc64le with or without cgo. Adding callCgoSigaction and calling that allows signals to be registered so that signal forwarding works. For linux-ppc64 and aix-ppc64, this won't change. On linux-ppc64 there is no cgo. I can't test aix-ppc64 so those owners can enable it if they want. In reviewing comments about sigtramp in sys_linux_arm64 it was noted that a previous issue in arm64 due to missing callee save registers could also be a problem on ppc64x, so code was added to save and restore those. Also, the use of R31 as a temp register in some cases caused an issue since it is a nonvolatile register in C and was being clobbered in cases where the C code expected it to be valid. The code sequences to load these addresses were changed to avoid the use of R31 when loading such an address. To get around a vet error, the stubs_ppc64x.go file in runtime was split into stubs_ppc64.go and stubs_ppc64le.go. Updates #45040 Change-Id: Ia4ecff950613cbe1b89471790b1d3819d5b5cfb9 Reviewed-on: https://go-review.googlesource.com/c/go/+/306369 Trust: Lynn Boger <laboger@linux.vnet.ibm.com> Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Carlos Eduardo Seo <carlos.seo@linaro.org>
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>
2020-06-08all: avoid awkward wording from CL 236857Russ Cox
CL 236857 removed all uses of whitelist/blacklist, which is great. But it substituted awkward phrasing using allowlist/blocklist, especially as verbs or participles. This CL uses more standard English, like "allow the function" or "blocked functions" instead of "allowlist the function" or "blocklisted functions". Change-Id: I9106a2fdbd62751c4cbda3a77181358a8a6d0f13 Reviewed-on: https://go-review.googlesource.com/c/go/+/236917 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-08all: replace usages of whitelist/blacklist and master/slaveFilippo Valsorda
There's been plenty of discussion on the usage of these terms in tech. I'm not trying to have yet another debate. It's clear that there are people who are hurt by them and who are made to feel unwelcome by their use due not to technical reasons but to their historical and social context. That's simply enough reason to replace them. Anyway, allowlist and blocklist are more self-explanatory than whitelist and blacklist, so this change has negative cost. Didn't change vendored, bundled, and minified files. Nearly all changes are tests or comments, with a couple renames in cmd/link and cmd/oldlink which are extremely safe. This should be fine to land during the freeze without even asking for an exception. Change-Id: I8fc54a3c8f9cc1973b710bbb9558a9e45810b896 Reviewed-on: https://go-review.googlesource.com/c/go/+/236857 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Khosrow Moossavi <khos2ow@gmail.com> Reviewed-by: Leigh McCulloch <leighmcc@gmail.com> Reviewed-by: Urban Ishimwe <urbainishimwe@gmail.com>
2019-04-16runtime: avoid getg in preinit on AndroidElias Naur
sigaction is called as part of library mode initializers (_rt0_*_lib). Sigaction in turn calls getg, but on Android the TLS offset for g has not been initialized and getg might return garbage. Add a check for initialization before calling getg. Fixes the golang.org/x/mobile/bind/java tests on amd64 and 386. Fixes #31476 Change-Id: Id2c41fdc983239eca039b49a54b8853c5669d127 Reviewed-on: https://go-review.googlesource.com/c/go/+/172158 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-05-02runtime: enable memory sanitizer on arm64Fangming.Fang
Changes include: 1. open compilation option -msan for arm64 2. modify doc to explain -msan is also supported on linux/arm64 3. wrap msan lib API in msan_arm64.s 4. use libc for sigaction syscalls when cgo is enabled 5. use libc for mmap syscalls when cgo is enabled Change-Id: I26ebe61ff7ce1906125f54a0182a720f9d58ec11 Reviewed-on: https://go-review.googlesource.com/109255 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-21all: enable c-shared/c-archive support for freebsd/amd64Tim Wright
Fixes #14327 Much of the code is based on the linux/amd64 code that implements these build modes, and code is shared where possible. Change-Id: Ia510f2023768c0edbc863aebc585929ec593b332 Reviewed-on: https://go-review.googlesource.com/93875 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-07runtime: change from rt_sigaction to sigactionIan Lance Taylor
This normalizes the Linux code to act like other targets. The size argument to the rt_sigaction system call is pushed to a single function, sysSigaction. This is intended as a simplification step for CL 93875 for #14327. Change-Id: I594788e235f0da20e16e8a028e27ac8c883907c4 Reviewed-on: https://go-review.googlesource.com/99077 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2017-07-20runtime: don't call libc sigaction function in forked childIan Lance Taylor
If we are using vfork, and if something (such as TSAN) is intercepting the sigaction function, then we must call the system call, not the libc function. Otherwise the intercepted sigaction call in the child may trash the data structures in the parent. Change-Id: Id9588bfeaa934f32c920bf829c5839be5cacf243 Reviewed-on: https://go-review.googlesource.com/50251 Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com> Reviewed-by: Austin Clements <austin@google.com>
2016-11-16runtime/cgo: use libc for sigaction syscalls when possibleBryan C. Mills
This ensures that runtime's signal handlers pass through the TSAN and MSAN libc interceptors and subsequent calls to the intercepted sigaction function from C will correctly see them. Fixes #17753. Change-Id: I9798bb50291a4b8fa20caa39c02a4465ec40bb8d Reviewed-on: https://go-review.googlesource.com/33142 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>