llvm-project
bbb90feb - [tsan] Fix ASLR edge case, and improve diagnostics (#97125)

Commit
1 year ago
[tsan] Fix ASLR edge case, and improve diagnostics (#97125) In extremely rare cases (estimated 1 in 3 million), minor allocations that happen after the memory layout was checked in InitializePlatformEarly() [1] may result in the memory layout unexpectedly being incompatible in InitializePlatform(). We fix this by adding another memory layout check (and opportunity to re-exec without ASLR) in InitializePlatform(). To improve future debuggability, this patch also dumps the process map if the memory layout is unexpectedly incompatible. [1] ``` __sanitizer::InitializePlatformEarly(); __tsan::InitializePlatformEarly(); #if !SANITIZER_GO InitializeAllocator(); // <-- ~8MB mmap'ed ReplaceSystemMalloc(); #endif if (common_flags()->detect_deadlocks) ctx->dd = DDetector::Create(flags()); // <-- ~4MB mmap'ed Processor *proc = ProcCreate(); // <-- ~1MB mmap'ed ProcWire(proc, thr); InitializeInterceptors(); <-- ~3MB mmap'ed InitializePlatform(); ```
Author
Parents
Loading