-
Notifications
You must be signed in to change notification settings - Fork 931
Incorrect default MI_TLS_SLOT value #1078
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
Comments
You may well be right -- the use of static TLS on Windows is still a bit experimental (but it really improves codegen for |
Maybe this is a cautionary tale that undocumented OS internals, in fact, do sometimes change 😛 Strictly speaking, there's no good default index; even if you're able to find an "unused" index, there's no guarantee it doesn't get used in the future, either because an OS component now needs it, or maybe because just stuff happens to shift around. Maybe there shouldn't be a default, rather a "bring your own TLS slot" scheme; this would at least be viable for OS components or drivers that end up mimalloc. And at least app developers that specify some slot to use should (hopefully) be aware of the risks and limitations. Speaking about codegen - I'm a bit curious, how do the different variants (TEB use, |
The current MI_TLS_SLOT in v3 uses offset
0x888
whenMI_WIN_USE_FIXED_TLS
is enabled:However I don't see how this makes any sense? That seems to be middle of TEB::Win32ClientInfo or to be more exact
afAsyncKeyStateRecentDown
field of thetagCLIENTINFO
type thatWin32ClientInfo
represents (at least on older windows versions, because seems like recent win11 touched that specific field). Basically if I'm not mistaken callingGetAsyncKeyState
would overwrite the mimalloc TLS "slot"?The text was updated successfully, but these errors were encountered: