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: support TLS slot indices over 64 on Windows #59824

Open
qmuntal opened this issue Apr 25, 2023 · 0 comments
Open

runtime: support TLS slot indices over 64 on Windows #59824

qmuntal opened this issue Apr 25, 2023 · 0 comments
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows
Milestone

Comments

@qmuntal
Copy link
Contributor

qmuntal commented Apr 25, 2023

Since go 1.20, the Go runtime allocates the TLS slot in the TEB TlsSlots instead of using the TEB arbitrary pointer. See CL 431775 for more context.

The problem is that the static TEB TlsSlots array only has capacity for 64 indices, when more slots are required TlsAlloc allocates them on a heap-allocated array. TlsGetValue abstracts this implementation detail, but we don't use TlsGetValue and our logic to retrieve the TLS value does not currently support retrieving the value from TlsSlots or the heap depending on the index.

For now I've submitted CL 486816 to fallback to the old behavior (TEB arbitrary pointer) in case the TLS index is higher than 64. This solution is temporal, as we should rely on the TEB arbitrary pointer.

This issue should track the effort (small or big, still don't know) to implement a solution that supported TLS indices higher than 64.

@qmuntal qmuntal added OS-Windows NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Apr 25, 2023
@qmuntal qmuntal self-assigned this Apr 25, 2023
@qmuntal qmuntal changed the title support TLS slot index over 64 on Windows support TLS slot indices over 64 on Windows Apr 25, 2023
@qmuntal qmuntal added this to the Go1.22 milestone Apr 25, 2023
@seankhliao seankhliao changed the title support TLS slot indices over 64 on Windows runtime: support TLS slot indices over 64 on Windows Apr 25, 2023
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Apr 25, 2023
@qmuntal qmuntal modified the milestones: Go1.22, Go1.23 Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows
Projects
Development

No branches or pull requests

2 participants