]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.16] runtime: non-strict InlTreeIndex lookup in Frames.Next
authorMichael Pratt <mpratt@google.com>
Thu, 11 Mar 2021 17:28:45 +0000 (12:28 -0500)
committerDavid Chase <drchase@google.com>
Wed, 31 Mar 2021 16:59:18 +0000 (16:59 +0000)
commit887c0d890fd33a72cc1de6316252ba37649145cb
treee73d48d787fb29e7bfb5df5a52077a350bc8bfdd
parent3a45c13094e2bf1ac1430ce6af8b8be80bf0938e
[release-branch.go1.16] runtime: non-strict InlTreeIndex lookup in Frames.Next

When using cgo, some of the frames can be provided by cgoTraceback, a
cgo-provided function to generate C tracebacks. Unlike Go tracebacks,
cgoTraceback has no particular guarantees that it produces valid
tracebacks.

If one of the (invalid) frames happens to put the PC in the alignment
region at the end of a function (filled with int 3's on amd64), then
Frames.Next will find a valid funcInfo for the PC, but pcdatavalue will
panic because PCDATA doesn't cover this PC.

Tolerate this case by doing a non-strict PCDATA lookup. We'll still show
a bogus frame, but at least avoid throwing.

For #44971
Fixes #45303

Change-Id: I9eed728470d6f264179a7615bd19845c941db78c
Reviewed-on: https://go-review.googlesource.com/c/go/+/301369
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
(cherry picked from commit e4a4161f1f3157550846e1b6bd4fe83aae15778e)
Reviewed-on: https://go-review.googlesource.com/c/go/+/305889
src/runtime/symtab.go
src/runtime/symtab_test.go