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: illegal instruction when building for old processor #68251

Closed
9072997 opened this issue Jun 29, 2024 · 7 comments
Closed

runtime/race: illegal instruction when building for old processor #68251

9072997 opened this issue Jun 29, 2024 · 7 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. Documentation Issues describing a change to documentation. NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@9072997
Copy link

9072997 commented Jun 29, 2024

Go version

go version devel go1.23-82c371a307 Fri Jun 28 19:59:35 2024 +0000 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/root/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/root/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/root/goroot'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/root/goroot/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='devel go1.23-82c371a307 Fri Jun 28 19:59:35 2024 +0000'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/root/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1955169089=/tmp/go-build -gno-record-gcc-switches'

What did you do?

On a Sun workstation with an AMD Opteron(tm) 144 Processor running Debian,

  1. Bootstrap the go compiler & toolchain (1.4, 1.17.13, 1.20.6) using build.bash
  2. For the master branch, run all.bash

What did you see happen?

./all.bash | tee ~/build-output
build-output

##### Testing race detector
signal: illegal instruction
FAIL	runtime/race	0.020s
FAIL
skipped due to earlier error
skipped due to earlier error
skipped due to earlier error
skipped due to earlier error
skipped due to earlier error
skipped due to earlier error
skipped due to earlier error

##### ../test
skipped due to earlier error

What did you expect to see?

Inspired by issue #63872 , I've been trying to see if GOAMD64=v1 actually runs on baseline v1 hardware. I'm not necessarily arguing that the race detector needs to run on the oldest amd64 processor I can get my hands on, but if amd64 has a baseline set of required processor features, we should document it.

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jun 29, 2024
@randall77
Copy link
Contributor

The race detector should run on v1 hardware. We even have a separate build of the race detector for that target (src/runtime/race/internal/amd64v1/*.syso).
It would be interesting to see what the bad instruction is. Try building a hello world program with the race detector and run it under a debugger.
(It probably isn't an instruction on the Go side, as we print more information when an illegal instruction trap happens while executing Go code.)

Does this same error happen for 1.22?

@9072997
Copy link
Author

9072997 commented Jun 29, 2024

I am now running 1.22 downloaded from go.dev.

root@sun:~# go version
go version go1.22.4 linux/amd64
root@sun:~# go build -race hello.go
root@sun:~# gdb hello
GNU gdb (Debian 13.1-3) 13.1
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from hello...
Loading Go Runtime support.
(gdb) run
Starting program: /root/hello
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGILL, Illegal instruction.
0x0000000000410af1 in __tsan::Context::Context() ()
(gdb) layout asm
image

@randall77
Copy link
Contributor

movddup is sse3, sure enough. Looks like we might have to rebuild the v1 syso. Not sure how that build failed to avoid disallowed instructions, but we'll look into it.

@thanm thanm added the NeedsFix The path to resolution is known, but the work has not been done. label Jul 1, 2024
@thanm
Copy link
Contributor

thanm commented Jul 1, 2024

@golang/runtime

@randall77
Copy link
Contributor

Unfortunately, I think I have to take that back. Our race detector has never worked without sse3. At least, I see that sse3 was enabled around 2014. (https://github.com/llvm/llvm-project commit 8744b1c1e3be0c7136c38fc9bc4d055aa58e105a)
See #53743
So I don't think there is any coding to do here. Probably a doc update to list the higher requirement for the race detector is all we are going to be able to do.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/595976 mentions this issue: mention higher arch requirement for amd64 race detector

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. Documentation Issues describing a change to documentation. NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

6 participants