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
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@martisch
Copy link
Contributor

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 Feedback is required from experts, contributors, and/or the community before a change can be made. label Sep 21, 2021
@gopherbot
Copy link
Contributor

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 <[email protected]>
TryBot-Result: Go Bot <[email protected]>
Reviewed-by: Martin Möhrmann <[email protected]>
Reviewed-by: Keith Randall <[email protected]>
Trust: Martin Möhrmann <[email protected]>
@mknyszek
Copy link
Contributor

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

@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. labels Nov 13, 2021
@golang golang locked and limited conversation to collaborators Nov 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants