Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime/pprof: lostProfileEvent stack breaks gentraceback guarantee [1.14 backport] #38118

Closed
gopherbot opened this issue Mar 27, 2020 · 3 comments
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Milestone

Comments

@gopherbot
Copy link

@prattmic requested issue #38096 to be considered for backport to the next 1.14 minor release.

@gopherbot, please open a backport issue for 1.14.

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label Mar 27, 2020
@gopherbot gopherbot added this to the Go1.14.2 milestone Mar 27, 2020
@gopherbot
Copy link
Author

Change https://golang.org/cl/226077 mentions this issue: [release-branch.go1.14] runtime/pprof: increment fake overflow record PC

@ianlancetaylor
Copy link
Contributor

This can cause crashes when profiling if a signal arrives at the wrong time. Cherry pick approved.

@ianlancetaylor ianlancetaylor added CherryPickApproved Used during the release process for point releases and removed CherryPickCandidate Used during the release process for point releases labels Mar 30, 2020
@gopherbot
Copy link
Author

Closed by merging edea4a7 to release-branch.go1.14.

gopherbot pushed a commit that referenced this issue Mar 30, 2020
gentraceback generates PCs which are usually following the CALL
instruction. For those that aren't, it fixes up the PCs so that
functions processing the output can unconditionally decrement the PC.

runtime_expandInlineFrames does this unconditional decrement when
looking up the function. However, the fake stack frame generated for
overflow records fails to meet the contract, and decrementing the PC
results in a PC in the previous function. If that function contains
inlined call, runtime_expandInlineFrames will not short-circuit and will
panic trying to look up a PC that doesn't exist.

Note that the added test does not fail at HEAD. It will only fail (with
a panic) if the function preceeding lostProfileEvent contains inlined
function calls. At the moment (on linux/amd64), that is
runtime/pprof.addMaxRSS, which does not.

Fixes #38118

Change-Id: Iad0819f23c566011c920fd9a5b1254719228da0b
Reviewed-on: https://go-review.googlesource.com/c/go/+/225661
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
(cherry picked from commit 4a8b9bd)
Reviewed-on: https://go-review.googlesource.com/c/go/+/226077
@golang golang locked and limited conversation to collaborators Mar 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

2 participants