1
0
mirror of https://github.com/golang/go synced 2024-11-26 06:47:58 -07:00

runtime: abort when receiving a signal on a non-Go thread on Windows

Currently if a signal lands on a non-Go thread that's handled by the Go
handler, Go will emit a message. However, unlike everywhere else in the
runtime, Go will not abort the process after, and the signal handler
will try to continue executing.

This leads to cascading failures and possibly even memory corruption.

For #45638.

Change-Id: I546f4e82f339d555bed295528d819ac883b92bc6
Reviewed-on: https://go-review.googlesource.com/c/go/+/316809
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
Michael Anthony Knyszek 2021-05-04 16:00:08 +00:00 committed by Michael Knyszek
parent d19e5493bd
commit cd28ca3a4e
4 changed files with 10 additions and 4 deletions

View File

@ -58,7 +58,9 @@ TEXT runtime·badsignal2(SB),NOSPLIT,$24
MOVL DX, 12(SP) MOVL DX, 12(SP)
MOVL $0, 16(SP) // overlapped MOVL $0, 16(SP) // overlapped
CALL *runtime·_WriteFile(SB) CALL *runtime·_WriteFile(SB)
MOVL BP, SI
// Does not return.
CALL runtime·abort(SB)
RET RET
// faster get/set last error // faster get/set last error

View File

@ -96,6 +96,8 @@ TEXT runtime·badsignal2(SB),NOSPLIT|NOFRAME,$48
MOVQ runtime·_WriteFile(SB), AX MOVQ runtime·_WriteFile(SB), AX
CALL AX CALL AX
// Does not return.
CALL runtime·abort(SB)
RET RET
// faster get/set last error // faster get/set last error

View File

@ -97,8 +97,8 @@ TEXT runtime·badsignal2(SB),NOSPLIT|NOFRAME,$0
MOVW runtime·_WriteFile(SB), R12 MOVW runtime·_WriteFile(SB), R12
BL (R12) BL (R12)
MOVW R4, R13 // restore SP // Does not return.
MOVM.IA.W (R13), [R4, R15] // pop {r4, pc} B runtime·abort(SB)
TEXT runtime·getlasterror(SB),NOSPLIT,$0 TEXT runtime·getlasterror(SB),NOSPLIT,$0
MRC 15, 0, R0, C13, C0, 2 MRC 15, 0, R0, C13, C0, 2

View File

@ -117,7 +117,9 @@ TEXT runtime·badsignal2(SB),NOSPLIT,$16-0
MOVD runtime·_WriteFile(SB), R12 MOVD runtime·_WriteFile(SB), R12
SUB $16, RSP // skip over saved frame pointer below RSP SUB $16, RSP // skip over saved frame pointer below RSP
BL (R12) BL (R12)
ADD $16, RSP
// Does not return.
B runtime·abort(SB)
RET RET