[all-commits] [llvm/llvm-project] bbb90f: [tsan] Fix ASLR edge case, and improve diagnostics...

Thurston Dang via All-commits all-commits at lists.llvm.org
Thu Jul 11 08:26:03 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bbb90feb8742b4a83c4bbfbbbdf0f9735939d184
      https://github.com/llvm/llvm-project/commit/bbb90feb8742b4a83c4bbfbbbdf0f9735939d184
  Author: Thurston Dang <thurston at google.com>
  Date:   2024-07-11 (Thu, 11 Jul 2024)

  Changed paths:
    M compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp

  Log Message:
  -----------
  [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();
```



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list