-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: linux/arm64 sigtramp seems wrong #31827
Comments
Yes, clearly Same for sys_openbsd_arm64.s and sys_netbsd_arm64.s. Thanks for pointing this out. CC @4a6f656c |
Change https://golang.org/cl/177045 mentions this issue: |
I doubt there is really need to save/restore the registers in I think the question should be: Why we save/restore those registers on darwin system? Is it necessary? |
@ianlancetaylor - I don't see why this would be necessary. When a signal is delivered the kernel preserves all of the register state in the trap frame, restoring all of the (possibly modified) register state on return from the signal handler. In the case of OpenBSD/arm64, see http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/arch/arm64/arm64/sig_machdep.c?rev=1.6 This is fairly standard behaviour - NetBSD is effectively the same via http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/aarch64/aarch64/sig_machdep.c?rev=1.1.28.2 I would expect Linux to do the same. |
@ianlancetaylor - fair enough, one could argue that the signal forwarding code should be preserving and restoring context (as the kernel would). I guess saving/restoring is the safe solution, although at a cost for the normal/non-forwarding case. |
Based on work by Mikael Urankar, Shigeru YAMAMOTO and @myfreeweb. Updates golang#24715 Change-Id: If3189a693ca0aa627029e22b0f91534bcf322bc0
As I understand it:
darwin/arm64 runtime.sigtramp saves callee-saved registers (r19-r27, g aka r28, r29) for this scenario
go/src/runtime/sys_darwin_arm64.s
Lines 152 to 163 in 59ea685
linux/arm64 sigtramp does not do this.
go/src/runtime/sys_linux_arm64.s
Lines 319 to 337 in 59ea685
I don't have a reproducer for this bug (or a setup for it), but it seems wrong.
Tell me your thoughts.
The text was updated successfully, but these errors were encountered: