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

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 19 12:23:34 PST 2019


cryptoad added inline comments.


================
Comment at: compiler-rt/lib/scudo/standalone/tsd_shared.h:83
+      TSDs[I].unlock();
+  }
+
----------------
cryptoad wrote:
> eugenis wrote:
> > I'm also concerned about the shared tsd code path. Is locking the tsd enough to ensure that no allocations will happen in the future? It looks like threads hold the tsd lock for as short a time as possible, and do the rest of the work such as updating the chuck state later without synchronization. This work may not be finished by the time malloc_disable returns. Could malloc_iterate be confused if it sees the allocator in that state?
> You are correct, a thread could still be updating a block by the time `disable` returns.
> 
> Hopefully the window is small enough for the amount of potential confusion to be low. Given that this is mostly used in the context of libmemunreachable, which is mostly for debugging purposes, I think a best-effort approach as opposed to a catch-all that might have stronger performance implication is acceptable.
> 
> To be fair there might be something better that I haven't thought about as well.
PS: I can add a TODO stating so.


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