Repository navigation
Conversation
|
r? @jhpratt rustbot has assigned @jhpratt. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
c68840f to
fe7ad5c
Compare
|
@bors try jobs=test-aarch64-apple-,test-x86_64-msvc- |
This comment has been minimized.
This comment has been minimized.
std: eargerly run TLS destructors to catch stack overflows try-job: test-aarch64-apple-* try-job: test-x86_64-msvc-*
This comment has been minimized.
This comment has been minimized.
|
💔 Test for 0f4573b failed: CI. Failed jobs:
|
|
I don't get why that test is failing – it's completely unrelated, and doesn't even fail when I run it locally. Is that known to be spurious? Anyway, I'll mark this as ready for review. |
fe7ad5c to
234d151
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This addresses #111272 on UNIX platforms with native TLS by eagerly running the destructors of TLS variables inside the thread main function while the stack overflow detection logic is still active. I've previously tried this strategy in #109858, but that failed on the Apple platforms because I removed the
_tlv_atexitimplementation ofguard::enablein favour of the pthread-TLS-based implementation which doesn't work on Apple (see the updated documentation in the corresponding file for why that is).This obviously requires us to always manage the list of destructors manually, even on platforms like Linux that allow registering a per-object destructor. While that makes it slightly harder to support the case where a library referencing an instance of
stddefined in a separate DSO is unloaded, we currently don't support that anyway –__cxa_thread_atexit_implprevents the unloading of the DSO referenced by thedso_symbolargument, but we always reference thedso_handleliving alongsidestdinstead of the one of the DSO where the variable is defined.I've also added a drive-by commit updating the documentation of the Apple thread guard with some interesting caveats I've recently come across.