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: TLS slot index over 64 and crash [1.20 backport] #60535

Closed
gopherbot opened this issue May 31, 2023 · 6 comments
Closed

runtime: TLS slot index over 64 and crash [1.20 backport] #60535

gopherbot opened this issue May 31, 2023 · 6 comments
Labels
CherryPickApproved Used during the release process for point releases compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge
Milestone

Comments

@gopherbot
Copy link
Contributor

@qmuntal requested issue #59213 to be considered for backport to the next 1.20 minor release.

@gopherbot please backport to Go 1.20

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label May 31, 2023
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label May 31, 2023
@gopherbot gopherbot added this to the Go1.20.5 milestone May 31, 2023
@mknyszek mknyszek added the CherryPickApproved Used during the release process for point releases label May 31, 2023
@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label May 31, 2023
@gopherbot gopherbot modified the milestones: Go1.20.5, Go1.20.6 Jun 6, 2023
@dmitshur
Copy link
Contributor

dmitshur commented Jun 19, 2023

@qmuntal Thanks for requesting this backport. The next step here is to create a cherry-pick CL following the https://go.dev/wiki/MinorReleases#making-cherry-pick-cls process.

CL 486816 backports to release-branch.go1.20 mostly cleanly, except not the change in the src/runtime/sys_windows_386.s file. I think it's because CL 454675 only happened in Go 1.21. Should the cherry-pick CL to 1.20 leave out the change to sys_windows_386.s, or do you suggest a different path for this backport? Thanks.

@dmitshur dmitshur added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jun 19, 2023
@qmuntal
Copy link
Contributor

qmuntal commented Jun 20, 2023

Should the cherry-pick CL to 1.20 leave out the change to sys_windows_386.s, or do you suggest a different path for this backport? Thanks.

I've submitted the cherry-pick leaving the sys_windows_386 out of it, as it does not apply. Thanks for the detailed explanation.

@gopherbot
Copy link
Contributor Author

Change https://go.dev/cl/504475 mentions this issue: [release-branch.go1.20] runtime: fallback to TEB arbitrary pointer when TLS slots are full

@dmitshur dmitshur removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jun 20, 2023
@qmuntal
Copy link
Contributor

qmuntal commented Jun 22, 2023

CL is ready, it just needs to be submitted. I don't have permissions to submit to a release branch.

@dmitshur
Copy link
Contributor

@qmuntal Thanks. I left minor comments on its commit message, and will submit it after they're resolved.

@gopherbot
Copy link
Contributor Author

Closed by merging 6b45fb7 to release-branch.go1.20.

gopherbot pushed a commit that referenced this issue Jun 22, 2023
…en TLS slots are full

Note: This CL is cherry-picked from CL 486816 omitting the changes
in sys_windows_386.s, which don't apply to go1.20 release branch
because windows/386 started using the TEB TLS slot in go1.21 (CL 454675).

The Go runtime allocates the TLS slot in the TEB TLS slots instead of
using the TEB arbitrary pointer. See CL 431775 for more context.

The problem is that the TEB TLS slots array only has capacity for 64
indices, allocating more requires some complex logic that we don't
support yet.

Although the Go runtime only allocates one index, a Go DLL can be
loaded in a process with more than 64 TLS slots allocated,
in which case it abort.

This CL avoids aborting by falling back to the older behavior, that
is to use the TEB arbitrary pointer.

Fixes #60535
Updates #59213

Change-Id: I39c73286fe2da95aa9c5ec5657ee0979ecbec533
Reviewed-on: https://go-review.googlesource.com/c/go/+/486816
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit 715d53c)
Reviewed-on: https://go-review.googlesource.com/c/go/+/504475
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
@golang golang locked and limited conversation to collaborators Jun 21, 2024
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 compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

4 participants