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: deeply nested struct initialized with non-zero values [1.15 backport] #46656

Closed
gopherbot opened this issue Jun 9, 2021 · 3 comments
Closed
Labels
CherryPickApproved FrozenDueToAge
Milestone

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented Jun 9, 2021

@thanm requested issue #46653 to be considered for backport to the next 1.15 minor release.

@gopherbot please consider this for backport to 1.15 and 1.16

@gopherbot gopherbot added the CherryPickCandidate label Jun 9, 2021
@gopherbot gopherbot added this to the Go1.15.14 milestone Jun 9, 2021
@gopherbot
Copy link
Author

@gopherbot gopherbot commented Jun 9, 2021

Change https://golang.org/cl/326213 mentions this issue: [release-branch.go1.15] cmd/link: fix handling of dupok mapzero syms

@heschi heschi added CherryPickApproved and removed CherryPickCandidate labels Jun 10, 2021
@heschi
Copy link
Contributor

@heschi heschi commented Jun 10, 2021

Approved.

gopherbot pushed a commit that referenced this issue Jun 29, 2021
The compiler machinery that generates "map.zero" symbols marks them as
RODATA and DUPOK, which is problematic when a given application has
multiple map zero symbols (from different packages) with varying
sizes: the dupok path in the loader assumes that if two symbols have
the same name, it is safe to pick any of the versions. In the case of
map.zero, the link needs to select the largest symbol, not an
arbitrary sym.

This patch changes the linker's dupok symbol loading path to detect
this problem, and in situations where we're loading a dupok symbol
whose name is the same as an existing symbol but whose size is large,
select the new dup over the old. Note: this fix differs from the one
used in 1.16/1.17, which uses content-addressable symbols instead.

Fixes #46656.

Change-Id: Iabd2feef01d448670ba795c7eaddc48c191ea276
Reviewed-on: https://go-review.googlesource.com/c/go/+/326211
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
(cherry picked from commit aa5540c)
Reviewed-on: https://go-review.googlesource.com/c/go/+/326213
@gopherbot
Copy link
Author

@gopherbot gopherbot commented Jun 29, 2021

Closed by merging b51bf4f to release-branch.go1.15.

@golang golang locked and limited conversation to collaborators Jun 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

2 participants