From 3caaaddffd605c0ec1787d68295b732fff73026b Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Tue, 29 Sep 2020 04:45:55 +0000 Subject: runtime: don't crash if vsyscall and vdso are disabled on x86_64 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 TryBot-Result: Go Bot Reviewed-by: Ian Lance Taylor Reviewed-by: Michael Pratt Trust: Michael Pratt --- src/runtime/vdso_linux_amd64.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/runtime/vdso_linux_amd64.go') diff --git a/src/runtime/vdso_linux_amd64.go b/src/runtime/vdso_linux_amd64.go index d9ab4ab3c6..4e9f748f4a 100644 --- a/src/runtime/vdso_linux_amd64.go +++ b/src/runtime/vdso_linux_amd64.go @@ -17,8 +17,7 @@ var vdsoSymbolKeys = []vdsoSymbolKey{ {"__vdso_clock_gettime", 0xd35ec75, 0x6e43a318, &vdsoClockgettimeSym}, } -// initialize with vsyscall fallbacks var ( - vdsoGettimeofdaySym uintptr = 0xffffffffff600000 - vdsoClockgettimeSym uintptr = 0 + vdsoGettimeofdaySym uintptr + vdsoClockgettimeSym uintptr ) -- cgit v1.3