runtime: suppress "unexpected return pc" any time we're in cgo

Currently, gentraceback suppresses the "unexpected return pc" error
for sigpanic's caller if the M was running C code.

However, there are various situations where a sigpanic is injected
into C code that can cause traceback to unwind *past* the sigpanic
before realizing that it's in trouble (the traceback beyond the
sigpanic will be wrong).

Rather than try to fix these issues for Go 1.10, this CL simply
disables complaining about unexpected return PCs if we're in cgo
regardless of whether or not they're from the sigpanic frame. Go 1.9
never complained about unexpected return PCs when printing, so this is
simply a step closer to the old behavior.

This should fix the openbsd-386 failures on the dashboard, though this
issue could affect any architecture.

Fixes #23640.

Change-Id: I8c32c1ee86a70d2f280661ed1f8caf82549e324b
Reviewed-on: https://go-review.googlesource.com/91136
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Austin Clements 2018-01-31 11:55:22 -05:00
parent d929e40e9a
commit 3ff41cdffa

View file

@ -287,7 +287,7 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
// But if callback is set, we're doing a garbage collection and must
// get everything, so crash loudly.
doPrint := printing
if doPrint && gp.m.incgo && f.entry == sigpanicPC {
if doPrint && gp.m.incgo {
// We can inject sigpanic
// calls directly into C code,
// in which case we'll see a C