[PATCH] D86168: [DFSan] Handle mmap() calls before interceptors are installed.

Matt Morehouse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 19 08:15:03 PDT 2020


morehouse added inline comments.


================
Comment at: compiler-rt/lib/dfsan/dfsan_interceptors.cpp:23
 
+static bool interceptors_initialized;
+
----------------
vitalybuka wrote:
> Have you considered EnsureInterceptorsInitialized from compiler-rt/lib/cfi/cfi.cpp or compiler-rt/lib/safestack/safestack.cpp
> I suspect it should not work as you can't do INTERCEPT_FUNCTION here
> 
> Anyway as is it's a data race, some synchronization is needed.
Initialization happens during preinit_array, when we're single-threaded.  The issue this solves is that initialization calls dlysm calls calloc calls mmap.  If we did lazy-initialization, we'd get infinite recursion.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86168



More information about the llvm-commits mailing list