aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/signal_unix.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2017-10-11 17:04:26 -0400
committerAustin Clements <austin@google.com>2017-10-11 22:17:30 +0000
commit44d9e96da9b7625be81f2c7eacf73fcc609874ce (patch)
tree2256e99a46d54e62a83e5bdd22a44f2dead62509 /src/runtime/signal_unix.go
parenta3e013b0824ba53168b5d91abdb6ce191510a89d (diff)
downloadgo-44d9e96da9b7625be81f2c7eacf73fcc609874ce.tar.gz
go-44d9e96da9b7625be81f2c7eacf73fcc609874ce.zip
runtime: don't try to free OS-created signal stacks
Android's libc creates a signal stack for every thread it creates. In Go, minitSignalStack picks up this existing signal stack and puts it in m.gsignal.stack. However, if we later try to exit a thread (because a locked goroutine is exiting), we'll attempt to stackfree this libc-allocated signal stack and panic. Fix this by clearing gsignal.stack when we unminitSignals in such a situation. This should fix the Android build, which is currently broken. Change-Id: Ieea8d72ef063d22741c54c9daddd8bb84926a488 Reviewed-on: https://go-review.googlesource.com/70130 Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/signal_unix.go')
-rw-r--r--src/runtime/signal_unix.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go
index 5ea4b9f631..a616d46bac 100644
--- a/src/runtime/signal_unix.go
+++ b/src/runtime/signal_unix.go
@@ -744,6 +744,10 @@ func unminitSignals() {
if getg().m.newSigstack {
st := stackt{ss_flags: _SS_DISABLE}
sigaltstack(&st, nil)
+ } else {
+ // We got the signal stack from someone else. Clear it
+ // so we don't get confused.
+ getg().m.gsignal.stack = stack{}
}
}