scudo: Call setCurrentTSD(nullptr) when bringing down the TSD registry in tests.

Otherwise, we will hit a use-after-free when testing multiple instances of
the same allocator on the same thread. This only recently became a problem
with D70552 which caused us to run both ScudoCombinedTest.BasicCombined and
ScudoCombinedTest.ReleaseToOS on the unit tests' main thread.

Differential Revision: https://reviews.llvm.org/D70760
This commit is contained in:
Peter Collingbourne 2019-11-26 19:17:10 -08:00
parent 2045d2c90e
commit f30fe16d49
1 changed files with 1 additions and 0 deletions

View File

@ -50,6 +50,7 @@ template <class Allocator, u32 MaxTSDCount> struct TSDRegistrySharedT {
void unmapTestOnly() {
unmap(reinterpret_cast<void *>(TSDs),
sizeof(TSD<Allocator>) * NumberOfTSDs);
setCurrentTSD(nullptr);
}
ALWAYS_INLINE void initThreadMaybe(Allocator *Instance,