-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Unloading a Rust dylib with TLS used segfaults on OSX #28794
Copy link
Copy link
Closed
Labels
A-thread-localsArea: Thread local storage (TLS)Area: Thread local storage (TLS)C-bugCategory: This is a bug.Category: This is a bug.O-macosOperating system: macOSOperating system: macOS
Description
The problem here is that we register a TLS destructor via _tlv_atexit when TLS is referenced the first time after it is used (e.g. when the dylib's function is called), but then when dlclose happens the function isn't actually there and a fault happens when the thread exits and tries to run its destructors.
I'm not entirely sure how we might handle this, perhaps there's a way to compile dylibs such that the TLS access is OK? Perhaps we should hook an "unload" event and deregister (e.g. leak) TLS destructors? Either way seems like a good thing to track!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-thread-localsArea: Thread local storage (TLS)Area: Thread local storage (TLS)C-bugCategory: This is a bug.Category: This is a bug.O-macosOperating system: macOSOperating system: macOS
Type
Fields
Give feedbackNo fields configured for issues without a type.