diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2019-11-26 19:17:10 -0800 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2019-11-27 09:55:14 -0800 |
commit | f30fe16d4902617a33dac1ebca066a7cb7e0f2ec (patch) | |
tree | d45c14860cf2f39c5b3ce920629e050a47e50a54 | |
parent | 2045d2c90e240bf618d4e10f78f38dedc6db9357 (diff) | |
download | bcm5719-llvm-f30fe16d4902617a33dac1ebca066a7cb7e0f2ec.tar.gz bcm5719-llvm-f30fe16d4902617a33dac1ebca066a7cb7e0f2ec.zip |
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
-rw-r--r-- | compiler-rt/lib/scudo/standalone/tsd_shared.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler-rt/lib/scudo/standalone/tsd_shared.h b/compiler-rt/lib/scudo/standalone/tsd_shared.h index a43cf3fc337..5f58068edf7 100644 --- a/compiler-rt/lib/scudo/standalone/tsd_shared.h +++ b/compiler-rt/lib/scudo/standalone/tsd_shared.h @@ -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, |