Commit f30fe16d authored by Peter Collingbourne's avatar Peter Collingbourne
Browse files

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
parent 2045d2c9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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,