aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/vdso_linux_amd64.go
AgeCommit message (Collapse)Author
2020-09-30runtime: don't crash if vsyscall and vdso are disabled on x86_64Andrei Vagin
If vdso is disabled, the goruntime calls gettimeofday from vsyscall, but if vsyscall is disabled too, all golang binaries crash: SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0xffffffffff600000} --- killed by SIGSEGV (core dumped) ++ vsyscall doesn't work as it was designed for a long time due to security reasons and now vsyscall is a little more expensive than real syscalls: https://github.com/torvalds/linux/commit/5cec93c216db This patch reworks the code to call syscalls if the vdso library isn't available. Change-Id: I16cbf3f49871bea91e26af1f49aa0ae2fbd3a01d GitHub-Last-Rev: 1d133cd30a5dee1fea9aee0fb4ea0b07e0e87f2a GitHub-Pull-Request: golang/go#41681 Reviewed-on: https://go-review.googlesource.com/c/go/+/257982 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com> Trust: Michael Pratt <mpratt@google.com>
2018-03-27runtime: use vDSO for clock_gettime on linux/arm64Meng Zhuo
Use the __vdso_clock_gettime fast path via the vDSO on linux/arm64 to speed up nanotime and walltime. This results in the following performance improvement for time.Now on Cavium ThunderX: name old time/op new time/op delta TimeNow 442ns ± 0% 163ns ± 0% -63.16% (p=0.000 n=10+10) And benchmarks on VDSO BenchmarkClockVDSOAndFallbackPaths/vDSO 10000000 166 ns/op BenchmarkClockVDSOAndFallbackPaths/Fallback 3000000 456 ns/op Change-Id: I326118c6dff865eaa0569fc45d1fc1ff95cb74f6 Reviewed-on: https://go-review.googlesource.com/99855 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> 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-05runtime: rename vdso symbols to use camel caseIan Lance Taylor
This was originally C code using names with underscores, which were retained when the code was rewritten into Go. Change the code to use Go-like camel case names. The names that come from the ELF ABI are left unchanged. Change-Id: I181bc5dd81284c07bc67b7df4635f4734b41d646 Reviewed-on: https://go-review.googlesource.com/98520 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-03-03runtime: remove unused __vdso_time_symTobias Klauser
It's unused since https://golang.org/cl/99320043 Change-Id: I74d69ff894aa2fb556f1c2083406c118c559d91b Reviewed-on: https://go-review.googlesource.com/98195 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-02-15runtime: move ELF structure definitions into own filesTobias Klauser
Move the ELF32 and ELF64 structure definitions into their own files so they can be reused when vDSO support is added for other architectures. Change-Id: Id0171b4e5cea4add8635743c881e3bf3469597af Reviewed-on: https://go-review.googlesource.com/93995 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2017-10-13runtime: factor amd64 specifics from vdso_linux.goFrank Somers
This is a preparation step for adding vDSO support on linux/386. This change relocates the elf64 and amd64 specifics from vdso_linux.go to a new vdso_linux_amd64.go. This should enable vdso_linux.go to be used for vDSO support on linux architectures other than amd64. - Relocate the elf64X structure definitions appropriate to amd64, and change their names to elfX so that the code in vdso_linux.go is ELFnn-agnostic. - Relocate the sym_keys and corresponding __vdso_* variables appropriate to amd64. - Provide an amd64-specific constant for the maximum byte size of an array, and use this in vdso_linux.go to compute constants for sizing the elf structure arrays traversed in the loaded vDSO. Change-Id: I1edb4e4ec9f2d79b7533aa95fbd09f771fa4edef Reviewed-on: https://go-review.googlesource.com/69391 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-11runtime: move vdso_linux_amd64.go to vdso_linux.goFrank Somers
This is a preparation step for adding vDSO support on linux/386. In a follow-on change, the vDSO ELF symbol lookup code in this file will be refactored so it can be used on multiple architectures. First, move the file to an architecture-neutral file name so that the change history is preserved. Build tags are added so that the build behaves as it did before. vdso_linux_amd64.go will be recreated later, just containing the amd64 specifics. If the move and refactor were combined in a single change, then the history to date would be lost because git would see the existing code as a new file. Change-Id: Iddb5da0d7faf141fd7cc835fe6a80c80153897e9 Reviewed-on: https://go-review.googlesource.com/69710 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-13runtime: support DT_GNU_HASH in VDSOAustin Clements
Currently we only support finding symbols in the VDSO using the old DT_HASH. These days everything uses DT_GNU_HASH instead. To keep up with the times and future-proof against DT_HASH disappearing from the VDSO in the future, this commit adds support for DT_GNU_HASH and prefers it over DT_HASH. Tested by making sure it found a DT_GNU_HASH section and all of the expected symbols in it, and then disabling the DT_GNU_HASH path and making sure the old DT_HASH path still found all of the symbols. Fixes #19649. Change-Id: I508c8b35a019330d2c32f04f3833b69cb2686f13 Reviewed-on: https://go-review.googlesource.com/45511 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-04-16runtime: common handling of _AT_RANDOM auxvAustin Clements
The Linux kernel provides 16 bytes of random data via the auxv vector at startup. Currently we consume this separately on 386, amd64, arm, and arm64. Now that we have a common auxv parser, handle _AT_RANDOM in the common path. Change-Id: Ib69549a1d37e2d07a351cf0f44007bcd24f0d20d Reviewed-on: https://go-review.googlesource.com/22062 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-16runtime: common auxv parserAustin Clements
Currently several different Linux architectures have separate copies of the auxv parser. Bring these all together into a single copy of the parser that calls out to a per-arch handler for each tag/value pair. This is in preparation for handling common auxv tags in one place. For #9993. Change-Id: Iceebc3afad6b4133b70fca7003561ae370445c10 Reviewed-on: https://go-review.googlesource.com/22061 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
2016-02-21all: use cannot instead of can notJosh Bleecher Snyder
You can not use cannot, but you cannot spell cannot can not. Change-Id: I2f0971481a460804de96fd8c9e46a9cc62a3fc5b Reviewed-on: https://go-review.googlesource.com/19772 Reviewed-by: Rob Pike <r@golang.org>
2015-11-12runtime: break out system-specific constants into package sysMichael Matloob
runtime/internal/sys will hold system-, architecture- and config- specific constants. Updates #11647 Change-Id: I6db29c312556087a42e8d2bdd9af40d157c56b54 Reviewed-on: https://go-review.googlesource.com/16817 Reviewed-by: Russ Cox <rsc@golang.org>
2014-12-10runtime: clean up & go-ify the hash function seederKeith Randall
Change-Id: I0e95f8a5962c547da20e19a356ae1cf8375c9107 Reviewed-on: https://go-review.googlesource.com/1270 Reviewed-by: Russ Cox <rsc@golang.org>
2014-11-11[dev.cc] runtime: convert operating system support code from C to GoRuss Cox
The conversion was done with an automated tool and then modified only as necessary to make it compile and run. [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/174830044