aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/defs_linux_amd64.go
AgeCommit message (Collapse)Author
2020-08-13runtime: revert signal stack mlockingAustin Clements
Go 1.14 included a (rather awful) workaround for a Linux kernel bug that corrupted vector registers on x86 CPUs during signal delivery (https://bugzilla.kernel.org/show_bug.cgi?id=205663). This bug was introduced in Linux 5.2 and fixed in 5.3.15, 5.4.2 and all 5.5 and later kernels. The fix was also back-ported by major distros. This workaround was necessary, but had unfortunate downsides, including causing Go programs to exceed the mlock ulimit in many configurations (#37436). We're reasonably confident that by the Go 1.16 release, the number of systems running affected kernels will be vanishingly small. Hence, this CL removes this workaround. This effectively reverts CLs 209597 (version parser), 209899 (mlock top of signal stack), 210299 (better failure message), 223121 (soft mlock failure handling), and 244059 (special-case patched Ubuntu kernels). The one thing we keep is the osArchInit function. It's empty everywhere now, but is a reasonable hook to have. Updates #35326, #35777 (the original register corruption bugs). Updates #40184 (request to revert in 1.15). Fixes #35979. Change-Id: Ie213270837095576f1f3ef46bf3de187dc486c50 Reviewed-on: https://go-review.googlesource.com/c/go/+/246200 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-02-24runtime: remove unused _F_SETFL const on linuxTobias Klauser
This constant is only used on libc-based platforms (aix, darwin, solaris). Change-Id: Ic57d1fe3b1501c5b552eddb9aba11f1e02510082 Reviewed-on: https://go-review.googlesource.com/c/go/+/220421 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-05runtime: mlock top of signal stack on Linux 5.2–5.4.1Austin Clements
Linux 5.2 introduced a bug that can corrupt vector registers on return from a signal if the signal stack isn't faulted in: https://bugzilla.kernel.org/show_bug.cgi?id=205663 This CL works around this by mlocking the top page of all Go signal stacks on the affected kernels. Fixes #35326, #35777 Change-Id: I77c80a2baa4780827633f92f464486caa222295d Reviewed-on: https://go-review.googlesource.com/c/go/+/209899 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: David Chase <drchase@google.com>
2019-10-20runtime: define nonblockingPipeIan Lance Taylor
This requires defining pipe, pipe2, and setNonblock for various platforms. The new function is currently only used on AIX. It will be used by later CLs in this series. Updates #27707 Change-Id: Id2f987b66b4c66a3ef40c22484ff1d14f58e9b31 Reviewed-on: https://go-review.googlesource.com/c/go/+/171822 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-15runtime: introduce and consistently use setNsec for timespecIan Lance Taylor
The general code for setting a timespec value sometimes used set_nsec and sometimes used a combination of set_sec and set_nsec. Standardize on a setNsec function that takes a number of nanoseconds and splits them up to set the tv_sec and tv_nsec fields. Consistently mark setNsec as go:nosplit, since it has to be that way on some systems including Darwin and GNU/Linux. Consistently use timediv on 32-bit systems to help stay within split-stack limits on processors that don't have a 64-bit division instruction. Change-Id: I6396bb7ddbef171a96876bdeaf7a1c585a6d725b Reviewed-on: https://go-review.googlesource.com/c/go/+/167389 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-09-18runtime: use MADV_FREE on Linux if availableTobias Klauser
On Linux, sysUnused currently uses madvise(MADV_DONTNEED) to signal the kernel that a range of allocated memory contains unneeded data. After a successful call, the range (but not the data it contained before the call to madvise) is still available but the first access to that range will unconditionally incur a page fault (needed to 0-fill the range). A faster alternative is MADV_FREE, available since Linux 4.5. The mechanism is very similar, but the page fault will only be incurred if the kernel, between the call to madvise and the first access, decides to reuse that memory for something else. In sysUnused, test whether MADV_FREE is supported and fall back to MADV_DONTNEED in case it isn't. This requires making the return value of the madvise syscall available to the caller, so change runtime.madvise to return it. Fixes #23687 Change-Id: I962c3429000dd9f4a00846461ad128b71201bb04 Reviewed-on: https://go-review.googlesource.com/135395 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-26runtime: unify handling of alternate signal stackIan Lance Taylor
Change all Unix systems to use stackt for the alternate signal stack (some were using sigaltstackt). Add OS-specific setSignalstackSP function to handle different types for ss_sp field, and unify all OS-specific signalstack functions into one. Unify handling of alternate signal stack in OS-specific minit and sigtrampgo functions via new functions minitSignalstack and setGsignalStack. Change-Id: Idc316dc69b1dd725717acdf61a1cd8b9f33ed174 Reviewed-on: https://go-review.googlesource.com/29757 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-10-20runtime: add syscalls needed for android/amd64 logging.Hyang-Ah Hana Kim
access, connect, socket. In Android-L, logging is done by writing the log messages to the logd process through a unix domain socket. Also, changed the arg types of those syscall stubs to match linux programming APIs. For golang/go#10743 Change-Id: I66368a03316e253561e9e76aadd180c2cd2e48f3 Reviewed-on: https://go-review.googlesource.com/15993 Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-25runtime: mark pages we return to kernel as NOHUGEPAGEKeith Randall
We return memory to the kernel with madvise(..., DONTNEED). Also mark returned memory with NOHUGEPAGE to keep the kernel from merging this memory into a huge page, effectively reallocating it. Only known to be a problem on linux/{386,amd64,amd64p32} at the moment. It may come up on other os/arch combinations in the future. Fixes #8832 Change-Id: Ifffc6627a0296926e3f189a8a9b6e4bdb54c79eb Reviewed-on: https://go-review.googlesource.com/5660 Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2014-11-19[dev.cc] runtime: add explicit siginfo.si_addr fieldAustin Clements
struct siginfo_t's si_addr field is part of a union. Previously, we represented this union in Go using an opaque byte array and accessed the si_addr field using unsafe (and wrong on 386 and arm!) pointer arithmetic. Since si_addr is the only field we use from this union, this replaces the opaque byte array with an explicit declaration of the si_addr field and accesses it directly. LGTM=minux, rsc R=rsc, minux CC=golang-codereviews https://golang.org/cl/179970044
2014-11-14[dev.cc] runtime: change set_sec to take int64Russ Cox
Fixes build. Tested that all these systems can make.bash. TBR=austin CC=golang-codereviews https://golang.org/cl/177770043
2014-11-14[dev.cc] runtime: fix linux buildRuss Cox
TBR=austin CC=golang-codereviews https://golang.org/cl/176760044
2014-11-11[dev.cc] runtime: convert defs_$GOOS_$GOARCH.h to GoRuss Cox
The conversion was done with an automated tool and then modified only as necessary to make it compile and run. In a few cases, defs_$GOOS_$GOARCH.go already existed, so the target here is defs1_$GOOS_$GOARCH.go. [This CL is part of the removal of C code from package runtime. See golang.org/s/dev.cc for an overview.] LGTM=r R=r CC=austin, dvyukov, golang-codereviews, iant, khr https://golang.org/cl/171490043