aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/FormatVariadic.cpp
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-04-11 09:52:13 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-04-11 10:30:31 +0200
commit1624be938dd2badf8297e63b6b330882b8023372 (patch)
tree495e82af584551fd9dc88049cd5a10a33a78f259 /llvm/lib/Support/FormatVariadic.cpp
parentefeb35e19563df911febe6a53151103c3b6011a5 (diff)
downloadllvm-1624be938dd2badf8297e63b6b330882b8023372.zip
llvm-1624be938dd2badf8297e63b6b330882b8023372.tar.gz
llvm-1624be938dd2badf8297e63b6b330882b8023372.tar.bz2
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
Diffstat (limited to 'llvm/lib/Support/FormatVariadic.cpp')
0 files changed, 0 insertions, 0 deletions