golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.99k stars 17.67k forks source link

SIGILL: illegal instruction on any go tool under macOS [1.14 backport] #37478

Closed gopherbot closed 4 years ago

gopherbot commented 4 years ago

@dmitshur requested issue #37459 to be considered for backport to the next 1.14 minor release.

@gopherbot Please open a backport for 1.14. This is a regression in 1.14, and it is a serious problem (program doesn't run on affected hardware) without a workaround.

gopherbot commented 4 years ago

Change https://golang.org/cl/221058 mentions this issue: [release-branch.go1.14] runtime: guard VZEROUPPER on CPU feature

UrbanLegend commented 4 years ago

It also affects 10.13.6 (High Sierra) ScreenShot

randall77 commented 4 years ago

@UrbanLegend I think you might be confusing macOS versions with Go versions. This issue should not depend on the macOS version at all. It just requires Go 1.14 and an old processor.

dmitshur commented 4 years ago

Approving per discussion in a release meeting because this is a serious issue without a workaround.

/cc @cagedmantis @toothrot

Jonconradt commented 4 years ago

My configuration is having this problem. Here is the hardware and OS information:

System Version: macOS 10.14.6 (18G3020) Kernel Version: Darwin 18.7.0 Model Name: Mac Pro Model Identifier: MacPro5,1 Processor Name: Quad-Core Intel Xeon Processor Speed: 2.26 GHz Number of Processors: 2 Total Number of Cores: 8 L2 Cache (per Core): 256 KB L3 Cache (per Processor): 8 MB Hyper-Threading Technology: Enabled Memory: 64 GB Boot ROM Version: 144.0.0.0.0

ppinter1 commented 4 years ago

Chirping in with essentially the same config as @Jonconradt, except my Boot ROM is 138.0.0.0.0.

cagedmantis commented 4 years ago

@cherrymui This issue has been approved. Feel free to merge when you have the opportunity.

cherrymui commented 4 years ago

@cagedmantis I don't think I have permission to submit to the release branch. I'll have to let you or the release team do that. Thanks.

cagedmantis commented 4 years ago

@cherrymui Sorry for the confusion.

gopherbot commented 4 years ago

Closed by merging c54e36905b394dea9fbcf816c3a6e6751187258d to release-branch.go1.14.

ghost commented 4 years ago

hi

i have same probleme but i can't see any solution :(

randall77 commented 4 years ago

The fix will be released when Go 1.14.1 comes out. For now, you will have to wait (or build a Go distribution for yourself, from tip or with the patch above applied to 1.14).

ghost commented 4 years ago

@randall77 i'm so sorry, how can i build or patch this ?

many thanks

randall77 commented 4 years ago

Something like:

git clone https://go.googlesource.com/go goroot
cd goroot
git checkout go1.14
git cherry-pick c54e36905b394dea9fbcf816c3a6e6751187258d
cd src
./make.bash
ghost commented 4 years ago

hi @randall77
thank you for your help, i apply this but this issue not fix my problem. i can't run hugo 0.66.0


``` SIGILL: illegal instruction PC=0x406a670 m=0 sigcode=1 goroutine 1 [running, locked to thread]: runtime.asyncPreempt() /usr/local/Cellar/go/1.14/libexec/src/runtime/preempt_amd64.s:8 fp=0xc000169720 sp=0xc000169718 pc=0x406a670 github.com/alecthomas/chroma/lexers/r.init() /Users/brew/Library/Caches/Homebrew/go_cache/pkg/mod/github.com/alecthomas/chroma@v0.7.1/lexers/r/racket.go:63 +0x21ea fp=0xc000169da8 sp=0xc000169720 pc=0x4679f6a runtime.doInit(0x692a420) /usr/local/Cellar/go/1.14/libexec/src/runtime/proc.go:5414 +0x8a fp=0xc000169dd8 sp=0xc000169da8 pc=0x40456aa runtime.doInit(0x6938540) /usr/local/Cellar/go/1.14/libexec/src/runtime/proc.go:5409 +0x57 fp=0xc000169e08 sp=0xc000169dd8 pc=0x4045677 runtime.doInit(0x6931f40) /usr/local/Cellar/go/1.14/libexec/src/runtime/proc.go:5409 +0x57 fp=0xc000169e38 sp=0xc000169e08 pc=0x4045677 runtime.doInit(0x69300e0) /usr/local/Cellar/go/1.14/libexec/src/runtime/proc.go:5409 +0x57 fp=0xc000169e68 sp=0xc000169e38 pc=0x4045677 runtime.doInit(0x6930080) /usr/local/Cellar/go/1.14/libexec/src/runtime/proc.go:5409 +0x57 fp=0xc000169e98 sp=0xc000169e68 pc=0x4045677 runtime.doInit(0x693c940) /usr/local/Cellar/go/1.14/libexec/src/runtime/proc.go:5409 +0x57 fp=0xc000169ec8 sp=0xc000169e98 pc=0x4045677 runtime.doInit(0x6932ec0) /usr/local/Cellar/go/1.14/libexec/src/runtime/proc.go:5409 +0x57 fp=0xc000169ef8 sp=0xc000169ec8 pc=0x4045677 runtime.doInit(0x6941280) /usr/local/Cellar/go/1.14/libexec/src/runtime/proc.go:5409 +0x57 fp=0xc000169f28 sp=0xc000169ef8 pc=0x4045677 runtime.doInit(0x69408e0) /usr/local/Cellar/go/1.14/libexec/src/runtime/proc.go:5409 +0x57 fp=0xc000169f58 sp=0xc000169f28 pc=0x4045677 runtime.doInit(0x69285a0) /usr/local/Cellar/go/1.14/libexec/src/runtime/proc.go:5409 +0x57 fp=0xc000169f88 sp=0xc000169f58 pc=0x4045677 runtime.main() /usr/local/Cellar/go/1.14/libexec/src/runtime/proc.go:190 +0x1ce fp=0xc000169fe0 sp=0xc000169f88 pc=0x4038aae runtime.goexit() /usr/local/Cellar/go/1.14/libexec/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000169fe8 sp=0xc000169fe0 pc=0x4068df1 rax 0xc0003ac000 rbx 0x0 rcx 0x3e0 rdx 0x6728ec rdi 0xc0003b2000 rsi 0x5d45760 rbp 0xc000169d98 rsp 0xc000169718 r8 0x8a3d9f7 r9 0x203000 r10 0x8 r11 0x75 r12 0xf5 r13 0x0 r14 0x5c19820 r15 0x0 rip 0x406a670 rflags 0x10206 cs 0x2b fs 0x0 gs 0x0 ```
dmitshur commented 4 years ago

@Shurikken From your log, it looks like the go binary that was in your PATH was still Go 1.14. Note that there are many mentions of /usr/local/Cellar/go/1.14 in your output.

It's possible the problem was that you didn't add the newly built go binary to your PATH after the ./make.bash step in the instructions @randall77 provided. Try this:

git clone https://go.googlesource.com/go gotip
cd gotip
git checkout go1.14
git cherry-pick c54e36905b394dea9fbcf816c3a6e6751187258d
cd src
./make.bash
export PATH="$(../bin/go env GOROOT)/bin:$PATH"
which go

which go should point to the go binary that was built in gotip/bin. Then, in the same terminal (to preserve the new PATH environment variable value), you can try go get github.com/gohugoio/hugo@v0.66.0 and see if that helps.

Thank you for helping confirm that this patch will fix the problem in the upcoming Go 1.14.1 release.

ghost commented 4 years ago

@dmitshur hi

i have problem when use cd src ./make.bash :

MacBook-de-user:src acountuser$ ./make.bash
./make.bash: line 165: /Users/acountuser/go1.4/bin/go: No such file or directory
Building Go cmd/dist using /Users/acountuser/go1.4. ()
ERROR: Cannot find /Users/acountuser/go1.4/bin/go.
Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4.
MacBook-de-valentin:src acountuser$ export PATH="$(../bin/go env GOROOT)/bin:$PATH"
-bash: ../bin/go: No such file or directory
MacBook-de-valentin:src acountuser$ which go
MacBook-de-valentin:src acountuser$ 
dmitshur commented 4 years ago

I see, the ./make.bash step failed because /Users/acountuser/go1.4/bin/go did not exist.

In order to run ./make.bash, you need to have another Go installation (any recent version that works for you) and set the GOROOT_BOOTSTRAP environment variable to point to it. Please see https://golang.org/doc/install/source#go14 for full details on this.

randall77 commented 4 years ago

The line number here:

/usr/local/Cellar/go/1.14/libexec/src/runtime/preempt_amd64.s:8 fp=0xc000169720 sp=0xc000169718 pc=0x406a670

corroborates the fact that you are still running a vanilla 1.14, not a patched one.

ghost commented 4 years ago

Excuse me i'm newby.... :( i use your solution and apply your code but when i use ./make.bash i have error code... i have go installation i don't understand why :(

randall77 commented 4 years ago

Show us. It's hard to debug for you when we can't see what you're doing. Copy-paste your entire shell session here.

Perhaps you can just wait until 1.14.1 comes out.

apriendeau commented 4 years ago

@dmitshur do we have a timeline for the release of 1.14.1?

dmitshur commented 4 years ago

@apriendeau We are actively making progress on the work that is necessary to get Go 1.14.1 and 1.13.9 releases out. I don't know the exact day it'll happen, but we're aiming to do it soon. /cc @toothrot @cagedmantis

rageycomma commented 4 years ago

Method of resolving this if you have go installed using brew: brew uninstall go && brew uninstall hugo Then brew install go && brew install hugo

This will remove an old version of go from your machine, then uninstall hugo compiled with that old version, then reinstall go at 1.14, then reinstall hugo which will compile it with 1.14. Easy peazy.

randall77 commented 4 years ago

Did brew patch the CL that fixes this issue into their Go 1.14? Because 1.14.1 with that CL is not out yet.

chadwhitacre commented 4 years ago

Method of resolving this if you have go installed using brew:

I just tried this and it didn't work.

Did brew patch the CL that fixes this issue into their Go 1.14?

Sooooooo ... no? :)

(P.S. Hi, @dmitshur! 👋 What interesting timing, this is my first time trying hugo. 😁)

grahammiln commented 4 years ago

To revert a brew based install of Go to v1.13.8:

brew uninstall go
brew install go@1.13
echo 'export PATH="/usr/local/opt/go@1.13/bin:$PATH"' >> ~/.bash_profile
brew pin go@1.13

To unpin and permit brew to update to the latest go:

brew unpin go@1.13

…and remove the previously inserted line from ~/.bash_profile.

tmm1 commented 4 years ago

@apriendeau We are actively making progress on the work that is necessary to get Go 1.14.1 and 1.13.9 releases out. I don't know the exact day it'll happen, but we're aiming to do it soon. /cc @toothrot @cagedmantis

Any updates on a go1.14.1 release?

randall77 commented 4 years ago

go1.14.1 is out and has a fix for this issue.

ianlancetaylor commented 4 years ago

For the record, all Go releases are announced on the low-volume golang-announce mailing list. For 1.14.1, see https://groups.google.com/d/msg/golang-announce/Ix2U_8WWmXo/a2nJkNW5AAAJ.