summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/gwp_asan/tests
Commit message (Collapse)AuthorAgeFilesLines
* [GWP-ASan] 32-bit test pointers, allow multi-init for test.Mitch Phillips2019-12-091-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: GWP-ASan test currently fail on 32-bit platforms, as some of the pointers are larger than `uintptr_t` on 32-bit platforms. Fix up all those instances. Also add an uncompress varint test where the result is an underflow. Furthermore, allow multi-init for testing. Each gtest when running `check-gwp_asan` apparently runs in its own instance, but when integrating these tests into Android, this behaviour isn't the same. We remove the global multi-init check here, to allow for testing to work elsewhere, and we're not really worried about multi-init anyway as it's part of our contract with the allocator. Reviewers: eugenis, vlad.tsyrklevich Reviewed By: eugenis Subscribers: #sanitizers, llvm-commits, pcc Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71121
* [GWP-ASan] Split options_parser and backtrace_sanitizer_common.Mitch Phillips2019-08-233-17/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: optional/options_parser and optional/backtrace_sanitizer_common are logically separate components. They both use sanitizer-common to power their functionality, but there was an unstated implicit dependency that in order for backtrace_sanitizer_common to function correctly, one had to also use options_parser. This was because options_parser called __sanitizer::InitialiseCommonFlags. This is a requirement for backtrace_sanitizer_common to work, as the sanitizer unwinder uses the sanitizer_common flags and will SEGV on a null page if they're not initialised correctly. This patch removes this hidden dependency. You can now use backtrace_sanitizer_common without the requirements of options_parser. This patch also makes the GWP-ASan unit tests only have a soft dependency on sanitizer-common. The unit tests previously explicitly used __sanitizer::Printf, which is now provided under tests/optional/printf_sanitizer_common. This allows Android to build the unit tests using their own signal-safe printf(). Reviewers: eugenis Reviewed By: eugenis Subscribers: srhines, mgorny, #sanitizers, llvm-commits, vlad.tsyrklevich, morehouse Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D66684 llvm-svn: 369825
* [GWP-ASan] Implement stack frame compression.Mitch Phillips2019-08-151-0/+258
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Remove a few straggler ".cc"s in compiler-rt/libNico Weber2019-08-015-5/+5
| | | | llvm-svn: 367589
* [GWP-ASan] Add generic unwinders and structure backtrace output.Mitch Phillips2019-07-023-3/+71
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Change GWP-ASan build to use '-pthread' instead of '-lpthread' in orderMitch Phillips2019-06-061-1/+1
| | | | | | | | to try and fix android buildbot. Also make sure that the empty dummy test contains an output file name so the android_build.py wrapper script doesn't check fail. llvm-svn: 362758
* [GWP-ASan] Core Guarded Pool Allocator [4].Mitch Phillips2019-06-056-2/+294
| | | | | | | | | | | | | | | | | | | | | 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
* Attempt to fix test failure for armv8.Mitch Phillips2019-05-301-2/+2
| | | | | | | | Looks like armv8 can't handle a thousand threads, which GWP-ASan requests when running a synchronised mutex test. Limiting this to 100 to attempt to fix the build issue. llvm-svn: 362163
* [GWP-ASan] Mutex implementation [2].Mitch Phillips2019-05-303-0/+152
Summary: See D60593 for further information. This patch pulls out the mutex implementation and the required definitions file. We implement our own mutex for GWP-ASan currently, because: 1. We must be compatible with the sum of the most restrictive elements of the supporting allocator's build system. Current targets for GWP-ASan include Scudo (on Linux and Fuchsia), and bionic (on Android). 2. Scudo specifies `-nostdlib++ -nonodefaultlibs`, meaning we can't use `std::mutex` or `mtx_t`. 3. We can't use `sanitizer_common`'s mutex, as the supporting allocators cannot afford the extra maintenance (Android, Fuchsia) and code size (Fuchsia) overheads that this would incur. In future, we would like to implement a shared base mutex for GWP-ASan, Scudo and sanitizer_common. This will likely happen when both GWP-ASan and Scudo standalone are not in the development phase, at which point they will have stable requirements. Reviewers: vlad.tsyrklevich, morehouse, jfb Reviewed By: morehouse Subscribers: dexonsmith, srhines, cfe-commits, kubamracek, mgorny, cryptoad, jfb, #sanitizers, llvm-commits, vitalybuka, eugenis Tags: #sanitizers, #llvm, #clang Differential Revision: https://reviews.llvm.org/D61923 llvm-svn: 362138
OpenPOWER on IntegriCloud