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: Add error message when running non GOAMD64=v1 on unsupported hardware #48506

Closed
martisch opened this issue Sep 21, 2021 · 2 comments
Closed
Labels
NeedsFix
Milestone

Comments

@martisch
Copy link
Contributor

@martisch martisch commented Sep 21, 2021

With #45453 we are introducing GOAMD64 to build binaries that are not supported on all amd64 machines.

This can lead to an illegal instruction exception when running such a binary.

We should make best effort to report when such a binary with GOAMD64 > v1 is run on unsupported hardware.

One way to check is to add some assembly early in the runtime startup like it is done to detect MMX on 386 and print a short error message then exit the go program:

TESTL $(1<<23), DX // MMX

Waiting for internal/cpu to initialise to then do the minimum hardware checks in go code is likely to late as by that time an instruction that was emitted by the go compiler could have been used that already is unsupported.

/cc @mdempsky @randall77

@martisch martisch added this to the Go1.18 milestone Sep 21, 2021
@ALTree ALTree added the NeedsDecision label Sep 21, 2021
@gopherbot
Copy link

@gopherbot gopherbot commented Sep 24, 2021

Change https://golang.org/cl/351191 mentions this issue: runtime: check amd64 microarchitecture level at startup

gopherbot pushed a commit that referenced this issue Nov 2, 2021
Make Go runtime throw if it's been compiled to assume instruction
set extensions that aren't available on the CPU.
Updates #48506

Change-Id: Ic4d6696e1cd6b28d389a86fe64e8175ea3ca135a
GitHub-Last-Rev: ba33837
GitHub-Pull-Request: #48514
Reviewed-on: https://go-review.googlesource.com/c/go/+/351191
Run-TryBot: Martin Möhrmann <martin@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Martin Möhrmann <martin@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Martin Möhrmann <martin@golang.org>
@mknyszek
Copy link
Contributor

@mknyszek mknyszek commented Nov 10, 2021

@martisch Is this fixed now? It looks like it, but I wanted to double check. Please close if so. Thanks!

@dmitshur dmitshur added NeedsFix and removed NeedsDecision labels Nov 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix
Projects
None yet
Development

No branches or pull requests

5 participants