diff options
author | Ian Lance Taylor <iant@golang.org> | 2015-12-21 22:27:01 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2015-12-24 17:00:04 +0000 |
commit | f7e51c132059a78953b768ca66e457b40985930e (patch) | |
tree | e83f12442cc839b5f2d80c14c3b7131666bc9746 /src/runtime/sys_openbsd_arm.s | |
parent | e4dcf5c8c22d98ac9eac7b9b226596229624cb1d (diff) | |
download | go-f7e51c132059a78953b768ca66e457b40985930e.tar.gz go-f7e51c132059a78953b768ca66e457b40985930e.zip |
runtime: adjust gsignal stack to current signal stack
If non-Go code calls sigaltstack before a signal is received, use
sigaltstack to determine the current signal stack and set the gsignal
stack to use it. This makes the Go runtime more robust in the face of
non-Go code. We still can't handle a disabled signal stack or a signal
triggered with SA_ONSTACK clear, but we now give clear errors for those
cases.
Fixes #7227.
Update #9896.
Change-Id: Icb1607e01fd6461019b6d77d940e59b3aed4d258
Reviewed-on: https://go-review.googlesource.com/18102
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Diffstat (limited to 'src/runtime/sys_openbsd_arm.s')
-rw-r--r-- | src/runtime/sys_openbsd_arm.s | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/src/runtime/sys_openbsd_arm.s b/src/runtime/sys_openbsd_arm.s index 8c951e46d4..29e89710af 100644 --- a/src/runtime/sys_openbsd_arm.s +++ b/src/runtime/sys_openbsd_arm.s @@ -208,7 +208,19 @@ TEXT runtime·sigprocmask(SB),NOSPLIT,$0 MOVW R0, ret+8(FP) RET -TEXT runtime·sigtramp(SB),NOSPLIT,$24 +TEXT runtime·sigfwd(SB),NOSPLIT,$0-16 + MOVW sig+4(FP), R0 + MOVW info+8(FP), R1 + MOVW ctx+12(FP), R2 + MOVW fn+0(FP), R11 + MOVW R13, R4 + SUB $24, R13 + BIC $0x7, R13 // alignment for ELF ABI + BL (R11) + MOVW R4, R13 + RET + +TEXT runtime·sigtramp(SB),NOSPLIT,$12 // If called from an external code context, g will not be set. // Save R0, since runtime·load_g will clobber it. MOVW R0, 4(R13) // signum @@ -216,30 +228,9 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$24 CMP $0, R0 BL.NE runtime·load_g(SB) - CMP $0, g - BNE 4(PC) - // Signal number saved in 4(R13). - MOVW runtime·badsignal(SB), R11 - BL (R11) - RET - - // Save g. - MOVW g, R3 - MOVW g, 20(R13) - - // g = m->signal - MOVW g_m(g), R8 - MOVW m_gsignal(R8), g - - // R0 already saved. - MOVW R1, 8(R13) // info - MOVW R2, 12(R13) // context - MOVW R3, 16(R13) // gp (original g) - - BL runtime·sighandler(SB) - - // Restore g. - MOVW 20(R13), g + MOVW R1, 8(R13) + MOVW R2, 12(R13) + BL runtime·sigtrampgo(SB) RET // int32 tfork(void *param, uintptr psize, M *mp, G *gp, void (*fn)(void)); |