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

maps: maps.Clone reference semantics when cloning a map with large value types [1.21 backport] #64475

Closed
gopherbot opened this issue Nov 30, 2023 · 4 comments
Labels
CherryPickApproved Used during the release process for point releases compiler/runtime Issues related to the Go compiler and/or runtime.
Milestone

Comments

@gopherbot
Copy link

@bcmills requested issue #64474 to be considered for backport to the next 1.21 minor release.

@gopherbot, please backport to Go 1.21. This appears to cause subtle aliasing bugs in cloned maps.

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label Nov 30, 2023
@gopherbot gopherbot added this to the Go1.21.5 milestone Nov 30, 2023
@bcmills bcmills added the compiler/runtime Issues related to the Go compiler and/or runtime. label Nov 30, 2023
@bcmills
Copy link
Member

bcmills commented Nov 30, 2023

(Note that the maps package was added in Go 1.21, so this does not also need to be backported to Go 1.20.)

@gopherbot
Copy link
Author

Change https://go.dev/cl/547375 mentions this issue: [release-branch.go1.21] maps: fix aliasing problems with Clone

@gopherbot gopherbot modified the milestones: Go1.21.5, Go1.21.6 Dec 5, 2023
@cagedmantis
Copy link
Contributor

Approved. It's a serious issue without a workaround.

@cagedmantis cagedmantis added the CherryPickApproved Used during the release process for point releases label Dec 6, 2023
@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Dec 6, 2023
@gopherbot
Copy link
Author

Closed by merging f6b203c to release-branch.go1.21.

gopherbot pushed a commit that referenced this issue Jan 4, 2024
Make sure to alloc+copy large keys and values instead of aliasing them,
when they might be updated by a future assignment.

Fixes #64475

Change-Id: Ie2226a81cf3897e4e2ee24472f2966d397ace53f
Reviewed-on: https://go-review.googlesource.com/c/go/+/546515
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
(cherry picked from commit 16d3040)
Reviewed-on: https://go-review.googlesource.com/c/go/+/547375
TryBot-Bypass: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CherryPickApproved Used during the release process for point releases compiler/runtime Issues related to the Go compiler and/or runtime.
Projects
None yet
Development

No branches or pull requests

3 participants