llvm-project/compiler-rt
Kostya Kortchinsky 9ef6faf496 [scudo][standalone] Fork support
Summary:
fork() wasn't well (or at all) supported in Scudo. This materialized
in deadlocks in children.

In order to properly support fork, we will lock the allocator pre-fork
and unlock it post-fork in parent and child. This is done via a
`pthread_atfork` call installing the necessary handlers.

A couple of things suck here: this function allocates - so this has to
be done post initialization as our init path is not reentrance, and it
doesn't allow for an extra pointer - so we can't pass the allocator we
are currently working with.

In order to work around this, I added a post-init template parameter
that gets executed once the allocator is initialized for the current
thread. Its job for the C wrappers is to install the atfork handlers.

I reorganized a bit the impacted area and added some tests, courtesy
of cferris@ that were deadlocking prior to this fix.

Subscribers: jfb, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D72470
2020-01-14 07:51:48 -08:00
..
cmake [CMake] Fix lld detection after D69685 2019-12-28 13:05:12 -08:00
docs
include [compiler-rt] Adapt for ptrace(2) changes in NetBSD-9.99.30 2019-12-24 20:34:58 +01:00
lib [scudo][standalone] Fork support 2020-01-14 07:51:48 -08:00
test [profile] Support merge pool size >= 10 2020-01-12 00:27:18 -08:00
tools Add GWP-ASan fuzz target to compiler-rt/tools. 2019-08-27 18:28:07 +00:00
unittests [Scudo] [GWP-ASan] Add GWP-ASan to Scudo Standalone. 2019-12-13 09:09:41 -08:00
utils [compiler-rt] Adapt for ptrace(2) changes in NetBSD-9.99.30 2019-12-24 20:34:58 +01:00
www [www] Change URLs to HTTPS. 2019-10-24 13:25:15 -07:00
.arcconfig [compiler-rt] Set up .arcconfig to point to new Diffusion CRT repository 2017-12-06 20:55:32 +00:00
.gitignore Add .pyc files to .gitignore to compiler-rt 2017-07-24 21:51:12 +00:00
CMakeLists.txt Fix include guard and properly order __deregister_frame_info. 2019-11-12 14:54:41 -08:00
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.TXT Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
README.txt

README.txt

Compiler-RT
================================

This directory and its subdirectories contain source code for the compiler
support routines.

Compiler-RT is open source software. You may freely distribute it under the
terms of the license agreement found in LICENSE.txt.

================================