diff options
author | Austin Clements <austin@google.com> | 2018-01-12 12:03:49 -0500 |
---|---|---|
committer | Austin Clements <austin@google.com> | 2018-01-23 19:50:18 +0000 |
commit | 9483a0bc23904af80e47aaa8cf1239b3012246d2 (patch) | |
tree | dea84ac3701eb61054260b04501ab743db375316 /src/runtime/signal_unix.go | |
parent | 9b49ac0366d3e3948adf5a30bfcff52049e1799a (diff) | |
download | go-9483a0bc23904af80e47aaa8cf1239b3012246d2.tar.gz go-9483a0bc23904af80e47aaa8cf1239b3012246d2.zip |
runtime: don't grow the stack on sigpanic if throwsplit
Currently, if a _SigPanic signal arrives in a throwsplit context,
nothing is stopping the runtime from injecting a call to sigpanic that
may attempt to grow the stack. This will fail and, in turn, mask the
real problem.
Fix this by checking for throwsplit in the signal handler itself
before injecting the sigpanic call.
Updates #21431, where this problem is likely masking the real problem.
Change-Id: I64b61ff08e8c4d6f6c0fb01315d7d5e66bf1d3e2
Reviewed-on: https://go-review.googlesource.com/87595
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/signal_unix.go')
-rw-r--r-- | src/runtime/signal_unix.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index ac191f302f..78649c52a9 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -360,6 +360,12 @@ func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) { // the signal handler. The effect is that the program will act as // though the function that got the signal simply called sigpanic // instead. +// +// This must NOT be nosplit because the linker doesn't know where +// sigpanic calls can be injected. +// +// The signal handler must not inject a call to sigpanic if +// getg().throwsplit, since sigpanic may need to grow the stack. func sigpanic() { g := getg() if !canpanic(g) { |