diff options
author | Ian Lance Taylor <iant@golang.org> | 2016-01-25 15:22:03 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2016-01-26 04:42:31 +0000 |
commit | 0408ca7de12d72025d40c4d28fd8d9fb142b3c87 (patch) | |
tree | 659a5f87a4ea814732dc4086ab2bdf45d0ac2cfe | |
parent | 99fa8c38393419fab1452ba5b157787b98f4497e (diff) | |
download | go-0408ca7de12d72025d40c4d28fd8d9fb142b3c87.tar.gz go-0408ca7de12d72025d40c4d28fd8d9fb142b3c87.zip |
runtime: don't check sigaltstack on darwin/{arm,arm64}
Use of the alternate signal stack on darwin/{arm,arm64} is reportedly
buggy, and the runtime function sigaltstack does nothing. So don't
check the sigaltstack result to decide how to handle the signal stack.
Fixes #14070.
Change-Id: Ie97ede8895fad721e3acc79225f2cafcbe1f3a81
Reviewed-on: https://go-review.googlesource.com/18940
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
-rw-r--r-- | src/runtime/os1_darwin.go | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/runtime/os1_darwin.go b/src/runtime/os1_darwin.go index e9e0b6aa1c..5c00407b2f 100644 --- a/src/runtime/os1_darwin.go +++ b/src/runtime/os1_darwin.go @@ -162,20 +162,25 @@ func minit() { // Initialize signal handling. _g_ := getg() - var st stackt - sigaltstack(nil, &st) - if st.ss_flags&_SS_DISABLE != 0 { - signalstack(&_g_.m.gsignal.stack) - _g_.m.newSigstack = true - } else { - // Use existing signal stack. - stsp := uintptr(unsafe.Pointer(st.ss_sp)) - _g_.m.gsignal.stack.lo = stsp - _g_.m.gsignal.stack.hi = stsp + st.ss_size - _g_.m.gsignal.stackguard0 = stsp + _StackGuard - _g_.m.gsignal.stackguard1 = stsp + _StackGuard - _g_.m.gsignal.stackAlloc = st.ss_size - _g_.m.newSigstack = false + // The alternate signal stack is buggy on arm and arm64. + // The signal handler handles it directly. + // The sigaltstack assembly function does nothing. + if GOARCH != "arm" && GOARCH != "arm64" { + var st stackt + sigaltstack(nil, &st) + if st.ss_flags&_SS_DISABLE != 0 { + signalstack(&_g_.m.gsignal.stack) + _g_.m.newSigstack = true + } else { + // Use existing signal stack. + stsp := uintptr(unsafe.Pointer(st.ss_sp)) + _g_.m.gsignal.stack.lo = stsp + _g_.m.gsignal.stack.hi = stsp + st.ss_size + _g_.m.gsignal.stackguard0 = stsp + _StackGuard + _g_.m.gsignal.stackguard1 = stsp + _StackGuard + _g_.m.gsignal.stackAlloc = st.ss_size + _g_.m.newSigstack = false + } } // restore signal mask from m.sigmask and unblock essential signals |