Commit 0408ca7d authored by Ian Lance Taylor's avatar Ian Lance Taylor

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: default avatarMinux Ma <minux@golang.org>
parent 99fa8c38
...@@ -162,20 +162,25 @@ func minit() { ...@@ -162,20 +162,25 @@ func minit() {
// Initialize signal handling. // Initialize signal handling.
_g_ := getg() _g_ := getg()
var st stackt // The alternate signal stack is buggy on arm and arm64.
sigaltstack(nil, &st) // The signal handler handles it directly.
if st.ss_flags&_SS_DISABLE != 0 { // The sigaltstack assembly function does nothing.
signalstack(&_g_.m.gsignal.stack) if GOARCH != "arm" && GOARCH != "arm64" {
_g_.m.newSigstack = true var st stackt
} else { sigaltstack(nil, &st)
// Use existing signal stack. if st.ss_flags&_SS_DISABLE != 0 {
stsp := uintptr(unsafe.Pointer(st.ss_sp)) signalstack(&_g_.m.gsignal.stack)
_g_.m.gsignal.stack.lo = stsp _g_.m.newSigstack = true
_g_.m.gsignal.stack.hi = stsp + st.ss_size } else {
_g_.m.gsignal.stackguard0 = stsp + _StackGuard // Use existing signal stack.
_g_.m.gsignal.stackguard1 = stsp + _StackGuard stsp := uintptr(unsafe.Pointer(st.ss_sp))
_g_.m.gsignal.stackAlloc = st.ss_size _g_.m.gsignal.stack.lo = stsp
_g_.m.newSigstack = false _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 // restore signal mask from m.sigmask and unblock essential signals
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment