forked from OSchip/llvm-project
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:
parent
2045d2c90e
commit
f30fe16d49
|
@ -50,6 +50,7 @@ template <class Allocator, u32 MaxTSDCount> struct TSDRegistrySharedT {
|
||||||
void unmapTestOnly() {
|
void unmapTestOnly() {
|
||||||
unmap(reinterpret_cast<void *>(TSDs),
|
unmap(reinterpret_cast<void *>(TSDs),
|
||||||
sizeof(TSD<Allocator>) * NumberOfTSDs);
|
sizeof(TSD<Allocator>) * NumberOfTSDs);
|
||||||
|
setCurrentTSD(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
ALWAYS_INLINE void initThreadMaybe(Allocator *Instance,
|
ALWAYS_INLINE void initThreadMaybe(Allocator *Instance,
|
||||||
|
|
Loading…
Reference in New Issue