[PATCH] D71719: [scudo][standalone] Implement TSD registry disabling

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 19 11:43:03 PST 2019


cryptoad added inline comments.


================
Comment at: compiler-rt/lib/scudo/standalone/tsd_exclusive.h:51
   ALWAYS_INLINE TSD<Allocator> *getTSDAndLock(bool *UnlockRequired) {
-    if (LIKELY(State == ThreadState::Initialized)) {
+    if (LIKELY(State == ThreadState::Initialized && !Disabled)) {
       *UnlockRequired = false;
----------------
eugenis wrote:
> cryptoad wrote:
> > eugenis wrote:
> > > is not this a data race?
> > I think it's OK for allocations to succeed until `disable()` returns, which I assume is the racey part you are referring to?
> If the read of Disabled is not an acquire-read, the thread may not observe the change for a very long time. If you want any guarantee there, both the reading and writing threads need to do some kind of synchronize-y thing.
> 
> This sounds like a hard problem if we don't want to sacrifice performance of the fast path.
> 
Right. I'll update this to use an atomic and run some quick tests.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71719/new/

https://reviews.llvm.org/D71719





More information about the llvm-commits mailing list