summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2019-11-26 19:17:10 -0800
committerPeter Collingbourne <peter@pcc.me.uk>2019-11-27 09:55:14 -0800
commitf30fe16d4902617a33dac1ebca066a7cb7e0f2ec (patch)
treed45c14860cf2f39c5b3ce920629e050a47e50a54
parent2045d2c90e240bf618d4e10f78f38dedc6db9357 (diff)
downloadbcm5719-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.h1
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,
OpenPOWER on IntegriCloud