-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: A QEMU signaling fix causes Go binaries to fail on startup. #33746
Comments
@dsnet who I mentioned this to previously. |
\cc @ianlancetaylor |
Change https://golang.org/cl/191000 mentions this issue: |
Is there a more robust way to handle this issue? From the signal(7) manpage http://man7.org/linux/man-pages/man7/signal.7.html:
Which says values 63 and 64 that qemu ends up using in the common case when SIGRTMAX==64 shouldn't be hardcoded. I'm bringing it up because currently Go programs compiled for linux/mips (mips mipsle mips64 mips64le) fail on startup running in qemu user mode on most architectures (amd64 etc.) due to a related issue. The go compiler hardcodes that realtime signals go up to 128 on linux/mips (implicitly that SIGRTMAX==128 on linux/mips https://github.com/golang/go/blob/77f9b2728eb08456899e6500328e00ec4829dddf/src/runtime/sigtab_linux_mipsx.go) and on startup sigaction on 65 and above fail on amd64 etc. It would be nice to have a solution general enough to allow mips programs to run under qemu user mode as well. |
From further discussion the situation with QEMU is complex. This issue was filed in anticipation of changes that have not yet occurred. So I am putting the issue on hold for now. |
Unsure if it's related, but I see similar crashes in the go compiler (ie |
@tomkcook Can you clarify what you mean by "similar crashes?" Can you show us the output of the crash? Thanks. |
Note that we currently lack a QEMU builder (#1508), and per http://golang.org/wiki/PortingPolicy, supported platforms require builders. I don't think we should be putting in QEMU-specific workarounds until/unless we have a builder to test for regressions in those workarounds. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
golang/go#33746 (comment) Removing ARM and ARM64 builds until a QEMU builder exists
Not sure when it happened, but I noticed that qemu-user 5.2.0 in Debian Bullseye works with Go binaries! As one bisect datapoint, qemu 4.2 in Ubuntu Focal doesn't work. (in this case, I tested Go 1.17 binaries in both cases) |
Is this still relevant to recent qemu/go releases? |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
tl;dr: In anticipation of a future QEMU work-around, Go should hide runtime
rt_sigaction
failures forSIGRTMAX - 1
, like it already does forSIGRTMAX
.QEMU user mode emulation has a bug where it will not correctly deliver the
SIGRTMIN + 1
signal. This is becauseSIGRTMIN + 1
is a glibc reserved signal, and it is caught in the emulator's glibc. To get around this issue there is a patch to mapSIGRTMIN + 1
toSIGRTMAX - 1
, a signal that is typically unused. QEMU already has a similar work-around, mappingSIGRTMIN
toSIGRTMAX
which is also a signal reserved by glibc.On startup, the Go attempts to register signal handlers for all signals, but it silently hides failures for
SIGRTMIN
,SIGRTMIN + 1
(the glibc reserved signals), andSIGRTMAX
(the QEMU mapped signal forSIGRTMIN
). If the QEMU patch is submitted, go programs running under QEMU will fail to run, due to panics when trying to register a handler forSIGRTMAX - 1
.If Go decides to preemptively fix this issue, the patch is simple: just ignore failures for signal
63
in addition to64
. I will follow up this issue with a patch shortly.The text was updated successfully, but these errors were encountered: