-
Notifications
You must be signed in to change notification settings - Fork 356
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
Properly deallocate thread locals #1369
Comments
To be sure, there is no memory to deallocate here, right? Library thread-locals are not addressable, they just provide word-sized storage. |
rust-random/rand#968 is related in the sense that it is also about deallocation of thread-locals. I wonder what it would take for Miri to be able to notice the problem in rand. @josephlr your input would be appreciated. :) You wrote
However, given that "thread-local" can refer to Rust's |
Hm, maybe you were talking about the Rust-level Indeed on that level I don't think |
I think you are right. (I am definitely not an expert in this area.) |
Note: this is currently blocked on rust-lang/rust#70685
Currently Miri has only partial support for deallocation of thread-locals. It runs destructors of the library thread locals (
src/shims/tls.rs
), but it does not deallocate the thread-local statics#[thread_local]
. As a result, Miri misses undefined behaviour in the following program:Fixing this issue before rust-lang/rust#70685 is very hard because currently we allocate thread local statics in
tcx.alloc_map
, which allows adding elements, but does not allow removing them.The text was updated successfully, but these errors were encountered: