Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime/race: race_linux_amd64.syso now depends on glibc 2.16 #37485

Closed
Roguelazer opened this issue Feb 26, 2020 · 20 comments
Closed

runtime/race: race_linux_amd64.syso now depends on glibc 2.16 #37485

Roguelazer opened this issue Feb 26, 2020 · 20 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. RaceDetector
Milestone

Comments

@Roguelazer
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.13.8 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/vagrant/.cache/go-build"
GOENV="/home/vagrant/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/vagrant/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/golang1.13/lib/golang"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/golang1.13/lib/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build152338807=/tmp/go-build"

What did you do?

I am attempting to build go 1.14 for our internal, EL6-based distribution. 1.12 and 1.13 work fine, but 1.14 fails any time it tries to build with -race with the following:

ld: race_linux_amd64.syso: in function `__sanitizer::ReExec()':
gotsan.cpp:(.text+0x1873c): undefined reference to `getauxval'
collect2: error: ld returned 1 exit status
FAIL	flag [build failed]
FAIL	net [build failed]
FAIL	os [build failed]
FAIL	os/exec [build failed]
FAIL	encoding/gob [build failed]
FAIL

It appears that race_linux_amd64.syso now has a dependency on glibc 2.16, whereas previous versions were built against glibc 2.12. This does not appear to be documented anywhere.

I do not have access to a system with the requisite LLVM dependencies to build a new race_linux_amd64.syso, but it would be great if that new dependency could be changed.

What did you expect to see?

A successful build

What did you see instead?

Failed self-tests

@bcmills
Copy link
Member

bcmills commented Feb 26, 2020

CC @dvyukov @randall77 (see CL 201898 / #33309)

@bcmills bcmills changed the title race_linux_amd64.syso now depends on glibc 2.16 runtime/race: race_linux_amd64.syso now depends on glibc 2.16 Feb 26, 2020
@bcmills bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 26, 2020
@bcmills bcmills added this to the Unplanned milestone Feb 26, 2020
@dvyukov
Copy link
Member

dvyukov commented Feb 27, 2020

I see there is some logic not use getauxval:
https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/sanitizer_common/sanitizer_getauxval.h#L24
We probably need to include Go build in that condition.

@Roguelazer
Copy link
Author

This is also broken in 1.14.1.

@gopherbot
Copy link

Change https://golang.org/cl/226981 mentions this issue: runtime/race: update some .syso files

gopherbot pushed a commit that referenced this issue Apr 3, 2020
Update race detector syso files for some platforms.

There's still 2 more to do, but they might take a while so I'm
mailing the ones I have now.

Note: some arm64 tests did not complete successfully due to out
of memory errors, but I suspect the .syso is correct.

Update #14481
Update #37485 (I think?)
Update #37355

Change-Id: I7e7e707a1fd7574855a538ba89dc11acc999c760
Reviewed-on: https://go-review.googlesource.com/c/go/+/226981
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@Roguelazer
Copy link
Author

This is also broken in 1.14.2.

@randall77
Copy link
Contributor

This should be fixed at tip (can you try tip? I've been told this issue has been fixed in compiler-rt but I haven't verified myself).
I don't think we've backported fixes like this before. We'll see if this qualifies for 1.14.3.

@gopherbot Please open a backport issue to 1.14.

@gopherbot
Copy link

Backport issue(s) opened: #38321 (for 1.14).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases.

@FiloSottile
Copy link
Contributor

Easiest way to test at tip is with golang.org/dl/gotip.

@Roguelazer
Copy link
Author

@FiloSottile is there a way to run the test suite with gotip? For now, I'm muddling through trying to make it work with my regular build commands.

@zikaeroh
Copy link
Contributor

zikaeroh commented Apr 9, 2020

If you want gotip to be your Go install temporarily, you can add it to PATH.

$ gotip download
$ export PATH=$(gotip env GOROOT)/src:$PATH
$ go version
go version devel +28157b3292 Thu Apr 9 21:18:55 2020 +0000 linux/amd64

EDIT: I see now that you want to build Go itself, and not test some external project. My mistake, do what's below instead. 🙂

@FiloSottile
Copy link
Contributor

You can either use gotip test -race selectively, or cd $(gotip env GOROOT)/src and run all.bash.

@ianlancetaylor
Copy link
Contributor

@Roguelazer We're still waiting on confirmation that this has been fixed on tip. Is there anything we can do to help you confirm that? Thanks.

@Roguelazer
Copy link
Author

Sorry; I only package Go; I don't actually use it very often.

$ set -x GOPATH ~/gotip_gopath/
$ go get golang.org/dl/gotip
$ set -x PATH ~/gotip_gopath/bin:$PATH
$ ./go/bin/gotip download
Cloning into '/home/vagrant/sdk/gotip'...
remote: Counting objects: 9858, done
remote: Finding sources: 100% (9858/9858)
remote: Total 9858 (delta 1330), reused 6549 (delta 1330)
Receiving objects: 100% (9858/9858), 23.87 MiB | 8.83 MiB/s, done.
Resolving deltas: 100% (1330/1330), done.
Updating files: 100% (9052/9052), done.
HEAD is now at 2491c5f runtime: wake scavenger and update address on sweep done
Building Go cmd/dist using /usr/lib/golang. (go1.6.3 linux/amd64)
Building Go toolchain1 using /usr/lib/golang.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for linux/amd64.
---
Installed Go for linux/amd64 in /home/vagrant/sdk/gotip
Installed commands in /home/vagrant/sdk/gotip/bin
Success. You may now run 'gotip'!
$ set -x PATH (gotip env GOROOT)/bin:$PATH
$ go version
go version devel +2491c5f Thu Apr 30 18:12:03 2020 +0000 linux/amd64
$ gotip test -race
package .: no Go files in /home/vagrant/
$ cd (gotip env GOROOT)/src
# cgo requires a much newer gcc as of go 1.14, which also totally stinks for people using stable distributions
$ set -x CC "/opt/gcc8/bin/gcc8"
$ set -x CC_FOR_TARGET "/opt/gcc8/bin/gcc8"
$ bash all.bash
Building Go cmd/dist using /usr/lib/golang. (go1.6.3 linux/amd64)
Building Go toolchain1 using /usr/lib/golang.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for linux/amd64.

##### Testing packages.
ok  	archive/tar	0.060s
[...snip..]
##### Testing race detector
ok  	runtime/race	11.245s
ok  	flag	0.072s
ok  	net	0.139s
ok  	os	0.122s
ok  	os/exec	0.102s
ok  	encoding/gob	0.039s
ok  	flag	0.082s
ok  	os/exec	0.085s
[...snip...]
ALL TESTS PASSED
---
Installed Go for linux/amd64 in /home/vagrant/sdk/gotip
Installed commands in /home/vagrant/sdk/gotip/bin

lgtm

@ianlancetaylor
Copy link
Contributor

Thanks!

@gopherbot
Copy link

Change https://golang.org/cl/231222 mentions this issue: [release-branch.go1.14] runtime/race: update some .syso files

gopherbot pushed a commit that referenced this issue May 4, 2020
Update race detector syso files for some platforms.

There's still 2 more to do, but they might take a while so I'm
mailing the ones I have now.

Note: some arm64 tests did not complete successfully due to out
of memory errors, but I suspect the .syso is correct.

For #14481
For #37485 (I think?)
For #37355
Fixes #38321

Change-Id: I7e7e707a1fd7574855a538ba89dc11acc999c760
Reviewed-on: https://go-review.googlesource.com/c/go/+/226981
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
(cherry picked from commit 041bcb3)
Reviewed-on: https://go-review.googlesource.com/c/go/+/231222
Reviewed-by: Keith Randall <khr@golang.org>
@gurpreetz
Copy link

Not to pile on, but with 1.14.3 I see this still happens for arm64.

race_linux_arm64.syso: In function `__sanitizer::GetPageSize()':
gotsan.cpp:(.text+0x492c): undefined reference to `getauxval'
collect2: error: ld returned 1 exit status

@rhysh
Copy link
Contributor

rhysh commented Jul 27, 2020

This is back for Go 1.15: I have a linux/amd64 build environment that uses glibc 2.12 which cannot build go1.15rc1, but can build go1.14.6. In that environment, fffe622 does not build but its parent commit, b8fd3ca, does. Here's the end of the unsuccessful build of go1.15rc1.

##### internal linking of -buildmode=pie
ok      reflect 0.168s
ok      os/user 0.004s

##### sync -cpu=10
ok      sync    0.252s

##### Testing race detector
# runtime/race
race_linux_amd64.syso:gotsan.cpp:function __sanitizer::ReExec(): error: undefined reference to 'getauxval'
collect2: error: ld returned 1 exit status
FAIL    runtime/race [build failed]
FAIL
2020/07/27 22:08:20 Failed: exit status 2
# runtime/race
race_linux_amd64.syso:gotsan.cpp:function __sanitizer::ReExec(): error: undefined reference to 'getauxval'
collect2: error: ld returned 1 exit status
FAIL    flag [build failed]
FAIL    net [build failed]
FAIL    os [build failed]
FAIL    os/exec [build failed]
FAIL    encoding/gob [build failed]
FAIL
2020/07/27 22:08:26 Failed: exit status 2
# runtime/race
race_linux_amd64.syso:gotsan.cpp:function __sanitizer::ReExec(): error: undefined reference to 'getauxval'
collect2: error: ld returned 1 exit status
FAIL    flag [build failed]
FAIL    os/exec [build failed]
FAIL
2020/07/27 22:08:26 Failed: exit status 2
go tool dist: FAILED

@FiloSottile FiloSottile modified the milestones: Unplanned, Go1.15 Jul 28, 2020
@FiloSottile
Copy link
Contributor

Milestone set to Go 1.15 to look into whether it's a regression.

@randall77
Copy link
Contributor

This does look like a regression, although I don't really understand why it happened. The corresponding tsan code doesn't look like it changed recently. Did we update the linux/amd64 builder to a >= 2.16 glibc from a < 2.16 glibc? (Tsan has the annoying C-derived property that it makes build decisions based on the machine that it is building on, not the machine it will run on.)

I have a simple patch to the thread sanitizer that will fix this. We'll need to rebuild the .syso files again after that patch goes in. Could be a day or two.

@randall77 randall77 self-assigned this Jul 28, 2020
@gopherbot
Copy link

Change https://golang.org/cl/246258 mentions this issue: runtime/race: rebuild some .syso files to remove getauxval dependency

@golang golang locked and limited conversation to collaborators Aug 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. RaceDetector
Projects
None yet
Development

No branches or pull requests

10 participants