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_amd64.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_amd64.s')
-rw-r--r-- | src/runtime/sys_openbsd_amd64.s | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/src/runtime/sys_openbsd_amd64.s b/src/runtime/sys_openbsd_amd64.s index 381354ea09..ed368babc0 100644 --- a/src/runtime/sys_openbsd_amd64.s +++ b/src/runtime/sys_openbsd_amd64.s @@ -228,37 +228,19 @@ TEXT runtime·sigprocmask(SB),NOSPLIT,$0 MOVL AX, ret+8(FP) RET -TEXT runtime·sigtramp(SB),NOSPLIT,$64 - get_tls(BX) - - // check that g exists - MOVQ g(BX), R10 - CMPQ R10, $0 - JNE 5(PC) - MOVQ DI, 0(SP) - MOVQ $runtime·badsignal(SB), AX +TEXT runtime·sigfwd(SB),NOSPLIT,$0-32 + MOVL sig+8(FP), DI + MOVQ info+16(FP), SI + MOVQ ctx+24(FP), DX + MOVQ fn+0(FP), AX CALL AX RET - // save g - MOVQ R10, 40(SP) - - // g = m->signal - MOVQ g_m(R10), AX - MOVQ m_gsignal(AX), AX - MOVQ AX, g(BX) - +TEXT runtime·sigtramp(SB),NOSPLIT,$24 MOVQ DI, 0(SP) MOVQ SI, 8(SP) MOVQ DX, 16(SP) - MOVQ R10, 24(SP) - - CALL runtime·sighandler(SB) - - // restore g - get_tls(BX) - MOVQ 40(SP), R10 - MOVQ R10, g(BX) + CALL runtime·sigtrampgo(SB) RET TEXT runtime·mmap(SB),NOSPLIT,$0 |