[all-commits] [llvm/llvm-project] efeb35: tsan: disable ASLR in Go test on NetBSD

Dmitry Vyukov via All-commits all-commits at lists.llvm.org
Sat Apr 11 01:31:01 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: efeb35e19563df911febe6a53151103c3b6011a5
      https://github.com/llvm/llvm-project/commit/efeb35e19563df911febe6a53151103c3b6011a5
  Author: Dmitry Vyukov <dvyukov at google.com>
  Date:   2020-04-11 (Sat, 11 Apr 2020)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
    M compiler-rt/lib/tsan/go/buildgo.sh

  Log Message:
  -----------
  tsan: disable ASLR in Go test on NetBSD

Tsan does not support ASLR on NetBSD.
Disable ASLR in the Go test and extend
the error message to be more actionable.

Reported-by: Keith Randall (khr)


  Commit: 1624be938dd2badf8297e63b6b330882b8023372
      https://github.com/llvm/llvm-project/commit/1624be938dd2badf8297e63b6b330882b8023372
  Author: Dmitry Vyukov <dvyukov at google.com>
  Date:   2020-04-11 (Sat, 11 Apr 2020)

  Changed paths:
    M compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
    M compiler-rt/lib/tsan/rtl/tsan_platform.h
    M compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp
    A compiler-rt/test/tsan/fiber_cleanup.cpp

  Log Message:
  -----------
  tsan: fix leak of ThreadSignalContext memory mapping when destroying fibers

When creating and destroying fibers in tsan a thread state is created and destroyed. Currently, a memory mapping is leaked with each fiber (in __tsan_destroy_fiber). This causes applications with many short running fibers to crash or hang because of linux vm.max_map_count.

The root of this is that ThreadState holds a pointer to ThreadSignalContext for handling signals. The initialization and destruction of it is tied to platform specific events in tsan_interceptors_posix and missed when destroying a fiber (specifically, SigCtx is used to lazily create the ThreadSignalContext in tsan_interceptors_posix). This patch cleans up the memory by makinh the ThreadState create and destroy the ThreadSignalContext.

The relevant code causing the leak with fibers is the fiber destruction:

void FiberDestroy(ThreadState *thr, uptr pc, ThreadState *fiber) {
  FiberSwitchImpl(thr, fiber);
  ThreadFinish(fiber);
  FiberSwitchImpl(fiber, thr);
  internal_free(fiber);
}

Author: Florian
Reviewed-in: https://reviews.llvm.org/D76073


Compare: https://github.com/llvm/llvm-project/compare/a517191a474f...1624be938dd2


More information about the All-commits mailing list