Call AsanThread::Destroy() from a late-running TSD destructor.
Previously we called it before any user-registered TSD destructors, which caused
false positives in LeakSanitizer.
Details
Diff Detail
Event Timeline
I'm OK with this change, but let's wait for Kostya's opinion as well.
lib/asan/asan_thread.cc | ||
---|---|---|
168 | I prefer if (!SANITIZER_POSIX) Elaborate whan "unhappy" means (thread will be treated as dead too early, so we'll fail to see live memory from this thread while it's still running TSD destructors). | |
lib/asan/asan_thread.h | ||
133 | Consider moving this to asan_internal.h next to other TSD-related functions. |
lib/asan/asan_thread.cc | ||
---|---|---|
176 | I don't like this 'if'. What will happen on Windos? Won't PlatformTSDDtor be called? |
lib/asan/asan_thread.cc | ||
---|---|---|
176 | It won't be called on Windows: void AsanTSDInit(void (*destructor)(void *tsd)) { // FIXME: we're ignoring the destructor for now. tsd_key_inited = true; } It shouldn't break in a bad way if PlatformTSDDtor will be called on Windows: if thread is already destroyed, AsanThread::Destroy() is a no-op. |
Consider moving this to asan_internal.h next to other TSD-related functions.