[GWP-ASan] Fix atfork handlers being installed multiple times in tests
authorMitch Phillips <31459023+hctim@users.noreply.github.com>
Tue, 10 Jan 2023 18:16:03 +0000 (10:16 -0800)
committerMitch Phillips <31459023+hctim@users.noreply.github.com>
Tue, 10 Jan 2023 18:16:08 +0000 (10:16 -0800)
commit296f7fbbb5c48a961aa31b2ffa1d048e6bfbd7a1
tree068920a842fd983de2f973f2a07fbd0991e02d72
parentfd7273359a33647b79df93d82a12a3ac6d589348
[GWP-ASan] Fix atfork handlers being installed multiple times in tests

We incorrectly install the atfork handlers multiple times in the test
harness, tracked down to the default parameter used by
CheckLateInitIsOK. This manifested in a hang if running the tests with
--gtest_repeat={>=2} as the atfork handler ran multiple times, causing
double-lock and double-unlock, which on my machine hung.

Add a check-fail for this case as well to prevent this from happening
again (it was difficult to track down and is an easy mistake to make).

Differential Revision: https://reviews.llvm.org/D139731
compiler-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_posix.cpp