]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: non-strict InlTreeIndex lookup in expandFinalInlineFrame
authorMichael Pratt <mpratt@google.com>
Fri, 9 Apr 2021 21:01:45 +0000 (17:01 -0400)
committerMichael Pratt <mpratt@google.com>
Mon, 12 Apr 2021 21:29:02 +0000 (21:29 +0000)
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.

Fixes #44971
Fixes #45480

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>

src/runtime/symtab.go

index 3d1f6126a602d56ee2baf3e78cc1f0183697e1c4..a382cf600282fe9a7252f5558616ed746d15764c 100644 (file)
@@ -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
                }