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

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 26 19:22:21 PST 2019


pcc created this revision.
pcc added reviewers: cryptoad, hctim.
Herald added projects: Sanitizers, LLVM.
Herald added a subscriber: Sanitizers.

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 <https://reviews.llvm.org/D70552> which caused us to run both ScudoCombinedTest.BasicCombined and
ScudoCombinedTest.ReleaseToOS on the unit tests' main thread.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70760

Files:
  compiler-rt/lib/scudo/standalone/tsd_shared.h


Index: compiler-rt/lib/scudo/standalone/tsd_shared.h
===================================================================
--- compiler-rt/lib/scudo/standalone/tsd_shared.h
+++ compiler-rt/lib/scudo/standalone/tsd_shared.h
@@ -50,6 +50,7 @@
   void unmapTestOnly() {
     unmap(reinterpret_cast<void *>(TSDs),
           sizeof(TSD<Allocator>) * NumberOfTSDs);
+    setCurrentTSD(nullptr);
   }
 
   ALWAYS_INLINE void initThreadMaybe(Allocator *Instance,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70760.231165.patch
Type: text/x-patch
Size: 454 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191127/8aec7129/attachment.bin>


More information about the llvm-commits mailing list