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

cmd/link: fix deferreturn detector [1.12 backport] #32484

Closed
gopherbot opened this issue Jun 7, 2019 · 5 comments
Closed

cmd/link: fix deferreturn detector [1.12 backport] #32484

gopherbot opened this issue Jun 7, 2019 · 5 comments
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Milestone

Comments

@gopherbot
Copy link

@randall77 requested issue #32477 to be considered for backport to the next 1.12 minor release.

@gopherbot, please open a backport to 1.12.

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label Jun 7, 2019
@gopherbot gopherbot added this to the Go1.12.6 milestone Jun 7, 2019
@randall77
Copy link
Contributor

This could lead to incorrect GC (sweep increased allocation count, and its friends) on arm and s390x.

@gopherbot
Copy link
Author

Change https://golang.org/cl/181262 mentions this issue: [release-branch.go1.12] cmd/link: fix deferreturn detector

@dmitshur
Copy link
Contributor

Our backport policy is to only backport fixes for security issues, serious problems with no workaround, and documentation fixes. @randall77 I understand this is a serious issue, but can you please confirm there's no workaround for this in 1.12? If so, we should approve this cherry-pick candidate, otherwise we should not.

/cc @ianlancetaylor

@randall77
Copy link
Contributor

There's no workaround for this.

@dmitshur dmitshur added CherryPickApproved Used during the release process for point releases and removed CherryPickCandidate Used during the release process for point releases labels Jun 10, 2019
@gopherbot
Copy link
Author

Closed by merging a6178d8 to release-branch.go1.12.

gopherbot pushed a commit that referenced this issue Jun 10, 2019
The logic for detecting deferreturn calls is wrong.

We used to look for a relocation whose symbol is runtime.deferreturn
and has an offset of 0. But on some architectures, the relocation
offset is not zero. These include arm (the offset is 0xebfffffe) and
s390x (the offset is 6).

This ends up setting the deferreturn offset at 0, so we end up using
the entry point live map instead of the deferreturn live map in a
frame which defers and then segfaults.

Instead, use the IsDirectJump helper to find calls.

Fixes #32484

Change-Id: Iecb530a7cf6eabd7233be7d0731ffa78873f3a54
Reviewed-on: https://go-review.googlesource.com/c/go/+/181258
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
(cherry picked from commit 9eb4031)
Reviewed-on: https://go-review.googlesource.com/c/go/+/181262
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
@golang golang locked and limited conversation to collaborators Jun 9, 2020
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

3 participants