OSDN Git Service

[GWP-ASan] enable/disable and fork support.
authorEvgenii Stepanov <eugenis@google.com>
Sat, 11 Jan 2020 00:01:01 +0000 (16:01 -0800)
committerEvgenii Stepanov <eugenis@google.com>
Fri, 24 Jan 2020 21:53:26 +0000 (13:53 -0800)
commit596d06145a2b94fa9549f0e8cadc641586dfab1d
treeeae6fd5017296b5c2c6fd7eb401e60c32fbc4952
parentda8bada9383379ad4bdce8016dd9441d88dafeb0
[GWP-ASan] enable/disable and fork support.

Summary:
* Implement enable() and disable() in GWP-ASan.
* Setup atfork handler.
* Improve test harness sanity and re-enable GWP-ASan in Scudo.

Scudo_standalone disables embedded GWP-ASan as necessary around fork().
Standalone GWP-ASan sets the atfork handler in init() if asked to. This
requires a working malloc(), therefore GWP-ASan initialization in Scudo
is delayed to the post-init callback.

Test harness changes are about setting up a single global instance of
the GWP-ASan allocator so that pthread_atfork() does not create
dangling pointers.

Test case shamelessly stolen from D72470.

Reviewers: cryptoad, hctim, jfb

Subscribers: mgorny, jfb, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D73294
13 files changed:
compiler-rt/lib/gwp_asan/guarded_pool_allocator.cpp
compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
compiler-rt/lib/gwp_asan/options.inc
compiler-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_posix.cpp
compiler-rt/lib/gwp_asan/tests/CMakeLists.txt
compiler-rt/lib/gwp_asan/tests/enable_disable.cpp [new file with mode: 0644]
compiler-rt/lib/gwp_asan/tests/harness.cpp [new file with mode: 0644]
compiler-rt/lib/gwp_asan/tests/harness.h
compiler-rt/lib/scudo/standalone/CMakeLists.txt
compiler-rt/lib/scudo/standalone/combined.h
compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
compiler-rt/lib/scudo/standalone/wrappers_c.inc