[all-commits] [llvm/llvm-project] b5ff18: tsan: mmap shadow stack

Dmitry Vyukov via All-commits all-commits at lists.llvm.org
Sat Nov 13 00:13:07 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b5ff187b7b51dd76f881e10c1c2b4033e672fb12
      https://github.com/llvm/llvm-project/commit/b5ff187b7b51dd76f881e10c1c2b4033e672fb12
  Author: Dmitry Vyukov <dvyukov at google.com>
  Date:   2021-11-13 (Sat, 13 Nov 2021)

  Changed paths:
    M compiler-rt/lib/tsan/rtl/tsan_mman.cpp
    M compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
    M compiler-rt/lib/tsan/rtl/tsan_rtl.h
    M compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp

  Log Message:
  -----------
  tsan: mmap shadow stack

We used to mmap C++ shadow stack as part of the trace region
before ed7f3f5bc9 ("tsan: move shadow stack into ThreadState"),
which moved the shadow stack into TLS. This started causing
timeouts and OOMs on some of our internal tests that repeatedly
create and destroy thousands of threads.
Allocate C++ shadow stack with mmap and small pages again.
This prevents the observed timeouts and OOMs.
But we now need to be more careful with interceptors that
run after thread finalization because FuncEntry/Exit and
TraceAddEvent all need the shadow stack.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D113786




More information about the All-commits mailing list