aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/panic.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2020-03-11 21:51:09 -0700
committerIan Lance Taylor <iant@golang.org>2020-03-13 21:56:51 +0000
commitb851e51160bc8ed412e229152b430b75e7ce56f9 (patch)
treed0e8f8608bf164454726fa1fc3c1aeeab18e3737 /src/runtime/panic.go
parentdcc5c249260526aa1b1534aa9f7f33228fcd25d7 (diff)
downloadgo-b851e51160bc8ed412e229152b430b75e7ce56f9.tar.xz
runtime: don't crash on mlock failure
Instead, note that mlock has failed, start trying the mitigation of touching the signal stack before sending a preemption signal, and, if the program crashes, mention the possible problem and a wiki page describing the issue (https://golang.org/wiki/LinuxKernelSignalVectorBug). Tested on a kernel in the buggy version range, but with the patch, by using `ulimit -l 0`. Fixes #37436 Change-Id: I072aadb2101496dffd655e442fa5c367dad46ce8 Reviewed-on: https://go-review.googlesource.com/c/go/+/223121 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/panic.go')
-rw-r--r--src/runtime/panic.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/runtime/panic.go b/src/runtime/panic.go
index c6ab1bac3f..28b5cbefcc 100644
--- a/src/runtime/panic.go
+++ b/src/runtime/panic.go
@@ -1281,6 +1281,12 @@ func startpanic_m() bool {
}
}
+// throwReportQuirk, if non-nil, is called by throw after dumping the stacks.
+//
+// TODO(austin): Remove this after Go 1.15 when we remove the
+// mlockGsignal workaround.
+var throwReportQuirk func()
+
var didothers bool
var deadlock mutex
@@ -1327,6 +1333,10 @@ func dopanic_m(gp *g, pc, sp uintptr) bool {
printDebugLog()
+ if throwReportQuirk != nil {
+ throwReportQuirk()
+ }
+
return docrash
}