Commit 5db80c30 authored by Mikio Hara's avatar Mikio Hara

runtime: revert CL 18835; don't install new signal stack unconditionally on dragonfly

This change reverts CL 18835 which is a workaroud for older DragonFly
BSD kernels, and fixes #14051, #14052 and #14067 in a more general way
the same as other platforms except NetBSD.

This change also bumps the minimum required version of DragonFly BSD
kernel to 4.4.4.

Fixes #16329.

Change-Id: I0b44b6afa675f5ed9523914226bd9ec4809ba5ae
Reviewed-on: https://go-review.googlesource.com/29491Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent e6134702
...@@ -201,16 +201,21 @@ func minit() { ...@@ -201,16 +201,21 @@ func minit() {
_g_.m.procid = uint64(*(*int32)(unsafe.Pointer(&_g_.m.procid))) _g_.m.procid = uint64(*(*int32)(unsafe.Pointer(&_g_.m.procid)))
// Initialize signal handling. // Initialize signal handling.
var st sigaltstackt
// On DragonFly a thread created by pthread_create inherits sigaltstack(nil, &st)
// the signal stack of the creating thread. We always create if st.ss_flags&_SS_DISABLE != 0 {
// a new signal stack here, to avoid having two Go threads signalstack(&_g_.m.gsignal.stack)
// using the same signal stack. This breaks the case of a _g_.m.newSigstack = true
// thread created in C that calls sigaltstack and then calls a } else {
// Go function, because we will lose track of the C code's // Use existing signal stack.
// sigaltstack, but it's the best we can do. 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
_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
nmask := _g_.m.sigmask nmask := _g_.m.sigmask
......
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