aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2021-04-09 17:01:45 -0400
committerCarlos Amedee <carlos@golang.org>2021-05-04 15:14:17 +0000
commitea0537f2fc66d1f2616c24dcbf08da197cb8205d (patch)
tree1fcc12937dcdb0a44543f8b38041029bfd1b815d
parente67a58b7cb2b228e04477dfdb1aacd8348e63534 (diff)
downloadgo-ea0537f2fc66d1f2616c24dcbf08da197cb8205d.tar.gz
go-ea0537f2fc66d1f2616c24dcbf08da197cb8205d.zip
[release-branch.go1.16] runtime: non-strict InlTreeIndex lookup in expandFinalInlineFrame
This is a follow-up to golang.org/cl/301369, which made the same change in Frames.Next. The same logic applies here: a profile stack may have been truncated at an invalid PC provided by cgoTraceback. expandFinalInlineFrame will then try to lookup the inline tree and crash. The same fix applies as well: upon encountering a bad PC, simply leave it as-is and move on. For #44971 For #45480 Fixes #45482 Change-Id: I2823c67a1f3425466b05384cc6d30f5fc8ee6ddc Reviewed-on: https://go-review.googlesource.com/c/go/+/309109 Reviewed-by: Michael Knyszek <mknyszek@google.com> Trust: Michael Pratt <mpratt@google.com> (cherry picked from commit aad13cbb749d1e6c085ff0556d306de1a2d5d063) Reviewed-on: https://go-review.googlesource.com/c/go/+/309551 Run-TryBot: Michael Pratt <mpratt@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org>
-rw-r--r--src/runtime/symtab.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go
index 09225fb03a..3341fc4916 100644
--- a/src/runtime/symtab.go
+++ b/src/runtime/symtab.go
@@ -185,7 +185,9 @@ func runtime_expandFinalInlineFrame(stk []uintptr) []uintptr {
var cache pcvalueCache
inltree := (*[1 << 20]inlinedCall)(inldata)
for {
- ix := pcdatavalue(f, _PCDATA_InlTreeIndex, tracepc, &cache)
+ // Non-strict as cgoTraceback may have added bogus PCs
+ // with a valid funcInfo but invalid PCDATA.
+ ix := pcdatavalue1(f, _PCDATA_InlTreeIndex, tracepc, &cache, false)
if ix < 0 {
break
}