From 3ff41cdffade9e7b5a78fa56a43351dbd665df7a Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Wed, 31 Jan 2018 11:55:22 -0500 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- src/runtime/traceback.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/traceback.go b/src/runtime/traceback.go index 2261942ab4..747176c278 100644 --- a/src/runtime/traceback.go +++ b/src/runtime/traceback.go @@ -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