[GWP-ASan] Guard against recursive allocs. Pack TLS for perf.
authorMitch Phillips <mitchphillips@outlook.com>
Tue, 25 Jun 2019 22:29:05 +0000 (22:29 +0000)
committerMitch Phillips <mitchphillips@outlook.com>
Tue, 25 Jun 2019 22:29:05 +0000 (22:29 +0000)
commit05d1a2bd1bf3c0172334bbdf21cdf97135ab2797
tree500cc053aeea66efb118b7515d5fc47e2aef4c0d
parent9c10b620c0619611dfe062216459431955ac4801
[GWP-ASan] Guard against recursive allocs. Pack TLS for perf.

Summary:
Add a recursivity guard for GPA::allocate(). This means that any
recursive allocations will fall back to the supporting allocator. In future
patches, we will introduce stack trace collection support. The unwinder will be
provided by the supporting allocator, and we can't guarantee they don't call
malloc() (e.g. backtrace() on posix may call dlopen(), which may call malloc().

Furthermore, this patch packs the new TLS recursivity guard into a thread local
struct, so that TLS variables should be hopefully not fall across cache lines.

Reviewers: vlad.tsyrklevich, morehouse, eugenis

Reviewed By: eugenis

Subscribers: kubamracek, #sanitizers, llvm-commits, eugenis

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D63736

llvm-svn: 364356
compiler-rt/lib/gwp_asan/guarded_pool_allocator.cpp
compiler-rt/lib/gwp_asan/guarded_pool_allocator.h