Skip to content

runtime: don't crash on nil g in sigtramp on windows arm64 platform #50889

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/runtime/sys_windows_arm64.s
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,16 @@ TEXT sigtramp<>(SB),NOSPLIT|NOFRAME,$0

BL runtime·load_g(SB) // smashes R0, R27, R28 (g)
CMP $0, g // is there a current g?
BNE 2(PC)
BL runtime·badsignal2(SB)
BNE g_not_nil

// in this case this is not a go thread, just return that we don't handle the exception
MOVD R7, LR
MOVD R16, R27 // restore R27
MOVD R17, g // restore R28
MOVD $0, R0 // return 0 (EXCEPTION_CONTINUE_SEARCH)
RET

g_not_nil:
// Do we need to switch to the g0 stack?
MOVD g, R3 // R3 = oldg (for sigtramp_g0)
MOVD g_m(g), R2 // R2 = m
Expand Down