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: go compiler with PIE enabled by default race segv #31384

Closed
jsimonetti opened this issue Apr 10, 2019 · 1 comment
Closed

runtime: go compiler with PIE enabled by default race segv #31384

jsimonetti opened this issue Apr 10, 2019 · 1 comment

Comments

@jsimonetti
Copy link

jsimonetti commented Apr 10, 2019

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

$ go version
go version go1.12.3 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

ArchLinux 5.0.7-arch1-1-ARCH #1 SMP PREEMPT

$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jsimonetti/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/jsimonetti/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
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-build181627555=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Testing code using -race on a go version with PIE enabled by default I get a segv and a ENOMEM error from the ThreadSanitizer.

What did you expect to see?

An error message similar to one when using the normal go compiler but with -buildmode=pie flag:

% go test -buildmode=pie  -race -count 1 .
-buildmode=pie not supported when -race is enabled

What did you see instead?

=7219==ERROR: ThreadSanitizer failed to allocate 0x2711000 (40964096) bytes at address 176bdd04c0000 (errno: 12)
unexpected fault address 0x0
fatal error: fault
unexpected fault address 0x55af73e8b59c
fatal error: fault
unexpected fault address 0x55af74aefbea
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x2 addr=0x55af74aefbea pc=0x55af74aefbea]

goroutine 1 [running, locked to thread]:
runtime: unexpected return pc for runtime.throw called from 0x55af73e8b1bc
stack: frame={sp:0x7ffdc4bfcfd0, fp:0x7ffdc4bfd000} stack=[0xc000044000,0xc000044800)

runtime.throw(0x3, 0x3)
	/usr/lib/go/src/runtime/panic.go:617 +0x74 fp=0x7ffdc4bfd000 sp=0x7ffdc4bfcfd0 pc=0x55af73c42c14

Edit:
Package managers' patch applied to default source:
https://git.archlinux.org/svntogit/community.git/tree/trunk/default-buildmode-pie.patch?h=packages/go

BTW, feel free to flag this as WONTFIX as this probably it not your problem.

@ianlancetaylor
Copy link
Contributor

This is a problem with the patch you are applying to the sources, not with the Go source code. There isn't anything we can do to fix this.

@golang golang locked and limited conversation to collaborators Apr 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants