summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
Commit message (Collapse)AuthorAgeFilesLines
* [GWP-ASan] Add GWP_ASAN_ prefix to macros.Mitch Phillips2019-11-251-5/+5
| | | | | | | | | | | | | | | | | Summary: When platforms use their own `LIKELY()` definitions, it can be quite troublesome to ensure they don't conflict with the GWP-ASan internal definitions. Just force the GWP_ASAN_ prefix to help this issue. Reviewers: eugenis Reviewed By: eugenis Subscribers: #sanitizers, llvm-commits, cferris, pcc Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D70683
* [GWP-ASan] Implement stack frame compression.Mitch Phillips2019-08-151-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch introduces stack frame compression to GWP-ASan. Each stack frame is variable-length integer encoded as the difference between frame[i] and frame[i - 1]. Furthermore, we use zig-zag encoding on the difference to ensure that negative differences are also encoded into a relatively small number of bytes. Examples of what the compression looks like can be seen in `gwp_asan/tests/compression.cpp`. This compression can reduce the memory consumption cost of stack traces by ~50%. Reviewers: vlad.tsyrklevich Reviewed By: vlad.tsyrklevich Subscribers: mgorny, #sanitizers, llvm-commits, eugenis, morehouse Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D66189 llvm-svn: 369048
* [GWP-ASan] Update backtrace function signature.Mitch Phillips2019-08-121-2/+3
| | | | | | | | | | | | | | | | | | | | Summary: Updates the function signature and comments for backtracing (and printing backtraces). This update brings GWP-ASan in line with future requirements for stack frame compression, wherein the length of the trace is provided explicitly, rather than relying on nullptr-termination. Reviewers: vlad.tsyrklevich Reviewed By: vlad.tsyrklevich Subscribers: #sanitizers, llvm-commits, morehouse Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D66099 llvm-svn: 368619
* [GWP-ASan] Add thread ID to PRNG seed.Mitch Phillips2019-07-161-4/+4
| | | | | | | | | | | | | | | | | | | Summary: Adds thread ID to PRNG seed for increased entropy. In particular, this allows multiple runs in quick succession that will have different PRNG seeds, allowing for better demos/testing. Reviewers: kcc Reviewed By: kcc Subscribers: kubamracek, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D64453 llvm-svn: 366253
* [GWP-ASan] Add generic unwinders and structure backtrace output.Mitch Phillips2019-07-021-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Adds two flavours of generic unwinder and all the supporting cruft. If the supporting allocator is okay with bringing in sanitizer_common, they can use the fast frame-pointer based unwinder from sanitizer_common. Otherwise, we also provide the backtrace() libc-based unwinder as well. Of course, the allocator can always specify its own unwinder and unwinder-symbolizer. The slightly changed output format is exemplified in the first comment on this patch. It now better incorporates backtrace information, and displays allocation details on the second line. Reviewers: eugenis, vlad.tsyrklevich Reviewed By: eugenis, vlad.tsyrklevich Subscribers: srhines, kubamracek, mgorny, cryptoad, #sanitizers, llvm-commits, morehouse Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D63841 llvm-svn: 364941
* [GWP-ASan] Guard against recursive allocs. Pack TLS for perf.Mitch Phillips2019-06-251-11/+22
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Fixup files added in r362636 to build with gcc 5.4. NFCIDouglas Yung2019-06-061-2/+2
| | | | llvm-svn: 362682
* [GWP-ASan] Core Guarded Pool Allocator [4].Mitch Phillips2019-06-051-0/+254
Summary: See D60593 for further information. This patch introduces the core of GWP-ASan, being the guarded pool allocator. This class contains the logic for creating and maintaining allocations in the guarded pool. Its public interface is to be utilised by supporting allocators in order to provide sampled guarded allocation behaviour. This patch also contains basic functionality tests of the allocator as unittests. The error-catching behaviour will be tested in upcoming patches that use Scudo as an implementing allocator. Reviewers: vlad.tsyrklevich, eugenis, jfb Reviewed By: vlad.tsyrklevich Subscribers: dexonsmith, kubamracek, mgorny, cryptoad, jfb, #sanitizers, llvm-commits, morehouse Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D62872 llvm-svn: 362636
OpenPOWER on IntegriCloud