summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/scudo
Commit message (Collapse)AuthorAgeFilesLines
...
* [scudo] Fix standalone compiler-rt test breakageKostya Kortchinsky2017-02-061-0/+2
| | | | | | | | | | | | | | | | | | | Summary: Apparently "test standalone compiler-rt" still requires -ldl and -lrt for Scudo even with --gc-sections. I am not entirely sure why, so if anybody has some input, feel free to chime in. In the meantime, add again those two to fix the test. Reviewers: kcc, alekseyshl Reviewed By: kcc Subscribers: Hahnfeld, dberris, llvm-commits Differential Revision: https://reviews.llvm.org/D29527 llvm-svn: 294199
* [scudo] Fix buildbot test error on ARMKostya Kortchinsky2017-02-031-2/+2
| | | | | | | | | | | | | | | | | | | Summary: The assumption __sanitizer_get_heap_size() == 0 (introduced in D29341) at the start of a program appears to be incorrect on some ARM machines (SizeClassAllocator32). This should fix the test while I investigate the issue. Reviewers: kcc, alekseyshl Reviewed By: alekseyshl Subscribers: aemerson, rengolin, llvm-commits Differential Revision: https://reviews.llvm.org/D29516 llvm-svn: 294056
* [scudo] 32-bit quarantine sizes adjustments and bug fixesKostya Kortchinsky2017-02-0315-115/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The local and global quarantine sizes were not offering a distinction for 32-bit and 64-bit platforms. This is addressed with lower values for 32-bit. When writing additional tests for the quarantine, it was discovered that when calling some of the allocator interface function prior to any allocation operation having occured, the test would crash due to the allocator not being initialized. This was addressed by making sure the allocator is initialized for those scenarios. Relevant tests were added in interface.cpp and quarantine.cpp. Last change being the removal of the extraneous link dependencies for the tests thanks to rL293220, anf the addition of the gc-sections linker flag. Reviewers: kcc, alekseyshl Reviewed By: alekseyshl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29341 llvm-svn: 294037
* [scudo] Enabling AArch64 support for ScudoKostya Kortchinsky2017-01-251-1/+1
| | | | | | | | | | | | | | | | | Summary: Adding ARM64 as a supported architecture for Scudo. The random shuffle is not yet supported for SizeClassAllocator32, which is used by the AArch64 allocator, so disable the associated test for now. Reviewers: kcc, alekseyshl, rengolin Reviewed By: rengolin Subscribers: aemerson, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D28960 llvm-svn: 293068
* [scudo] Replacing std::atomic with Sanitizer's atomicsKostya Kortchinsky2017-01-204-5/+3
| | | | | | | | | | | | | | | | | Summary: In an effort to getting rid of dependencies to external libraries, we are replacing atomic PackedHeader use of std::atomic with Sanitizer's atomic_uint64_t, which allows us to avoid -latomic. Reviewers: kcc, phosek, alekseyshl Reviewed By: alekseyshl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D28864 llvm-svn: 292630
* [scudo] Use the macro get_test_cc_for_arch for the testsKostya Kortchinsky2016-12-231-10/+1
| | | | | | | | | | | | Summary: The macro was introduced with D26929, use it in Scudo as well. Reviewers: kcc, alekseyshl, kubabrecka Subscribers: llvm-commits, danalbert, srhines, mgorny Differential Revision: https://reviews.llvm.org/D28066 llvm-svn: 290439
* [scudo] ARM32 supportKostya Kortchinsky2016-12-201-1/+1
| | | | | | | | | | | | | | | | Summary: With the previous modifications, the code works on ARM32. The random shuffle test is unsupported on 32-bit platforms for the moment and being marked as such. There is no hardware support for the checksum computation yet, this will come at a later point. Reviewers: kcc, alekseyshl Subscribers: llvm-commits, aemerson, rengolin, mgorny Differential Revision: https://reviews.llvm.org/D27957 llvm-svn: 290201
* [scudo] Relax the memalign testKostya Kortchinsky2016-12-141-2/+18
| | | | | | | | | | | | | | Summary: Now that we are not rounding up the sizes passed to the secondary allocator, the memalign test could run out of aligned addresses to return for larger alignments. We now reduce the size of the quarantine for that test, and allocate less chunks for the larger alignments. Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D27760 llvm-svn: 289665
* [scudo] 32-bit and hardware agnostic supportKostya Kortchinsky2016-11-3013-39/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This update introduces i386 support for the Scudo Hardened Allocator, and offers software alternatives for functions that used to require hardware specific instruction sets. This should make porting to new architectures easier. Among the changes: - The chunk header has been changed to accomodate the size limitations encountered on 32-bit architectures. We now fit everything in 64-bit. This was achieved by storing the amount of unused bytes in an allocation rather than the size itself, as one can be deduced from the other with the help of the GetActuallyAllocatedSize function. As it turns out, this header can be used for both 64 and 32 bit, and as such we dropped the requirement for the 128-bit compare and exchange instruction support (cmpxchg16b). - Add 32-bit support for the checksum and the PRNG functions: if the SSE 4.2 instruction set is supported, use the 32-bit CRC32 instruction, and in the XorShift128, use a 32-bit based state instead of 64-bit. - Add software support for CRC32: if SSE 4.2 is not supported, fallback on a software implementation. - Modify tests that were not 32-bit compliant, and expand them to cover more allocation and alignment sizes. The random shuffle test has been deactivated for linux-i386 & linux-i686 as the 32-bit sanitizer allocator doesn't currently randomize chunks. Reviewers: alekseyshl, kcc Subscribers: filcab, llvm-commits, tberghammer, danalbert, srhines, mgorny, modocache Differential Revision: https://reviews.llvm.org/D26358 llvm-svn: 288255
* [scudo] Lay the foundation for 32-bit supportKostya Kortchinsky2016-10-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Summary: In order to support 32-bit platforms, we have to make some adjustments in multiple locations, one of them being the Scudo chunk header. For it to fit on 64 bits (as a reminder, on x64 it's 128 bits), I had to crunch the space taken by some of the fields. In order to keep the offset field small, the secondary allocator was changed to accomodate aligned allocations for larger alignments, hence making the offset constant for chunks serviced by it. The resulting header candidate has been added, and further modifications to allow 32-bit support will follow. Another notable change is the addition of MaybeStartBackgroudThread() to allow release of the memory to the OS. Reviewers: kcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25688 llvm-svn: 285209
* [scudo] Fix an edge case in the secondary allocatorKostya Kortchinsky2016-09-303-15/+29
| | | | | | | | | | | | | | | Summary: s/CHECK_LT/CHECK_LE/ in the secondary allocator, as under certain circumstances Ptr + Size can be equal to MapEnd. This edge case was not found by the current tests, so those were extended to be able to catch that. Reviewers: kcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25101 llvm-svn: 282913
* [scudo] Fix a bug in the new Secondary AllocatorKostya Kortchinsky2016-09-201-42/+47
| | | | | | | | | | | | | | | | | | | Summary: GetActuallyAllocatedSize() was not accounting for the last page of the mapping being a guard page, and was returning the wrong number of actually allocated bytes, which in turn would mess up with the realloc logic. Current tests didn't find this as the size exercised was only serviced by the Primary. Correct the issue by subtracting PageSize, and update the realloc test to exercise paths in both the Primary and the Secondary. Reviewers: kcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D24787 llvm-svn: 282030
* [scudo] Modify Scudo to use its own Secondary AllocatorKostya Kortchinsky2016-09-191-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: The Sanitizer Secondary Allocator was not entirely ideal was Scudo for several reasons: decent amount of unneeded code, redundant checks already performed by the front end, unneeded data structures, difficulty to properly protect the secondary chunks header. Given that the second allocator is pretty straight forward, Scudo will use its own, trimming all the unneeded code off of the Sanitizer one. A significant difference in terms of security is that now each secondary chunk is preceded and followed by a guard page, thus mitigating overflows into and from the chunk. A test was added as well to illustrate the overflow & underflow situations into the guard pages. Reviewers: kcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D24737 llvm-svn: 281938
* [sanitizer] enable random shuffling the memory chunks inside the allocator, ↵Kostya Serebryany2016-08-261-0/+23
| | | | | | under a flag. Set this flag for the scudo allocator, add a test. llvm-svn: 279793
* [sanitizer] Implement a __asan_default_options() equivalent for ScudoKostya Serebryany2016-08-021-0/+25
| | | | | | | | | | | | | | Summary: Currently, the Scudo Hardened Allocator only gets its flags via the SCUDO_OPTIONS environment variable. With this patch, we offer the opportunity for programs to define their own options via __scudo_default_options() which behaves like __asan_default_options() (weak symbol). A relevant test has been added as well, and the documentation updated accordingly. I also used this patch as an opportunity to rename a few variables to comply with the LLVM naming scheme, and replaced a use of Report with dieWithMessage for consistency (and to avoid a callback). Reviewers: llvm-commits, kcc Differential Revision: https://reviews.llvm.org/D23018 llvm-svn: 277536
* [compiler-rt] Fix VisualStudio virtual folders layoutEtienne Bergeron2016-07-111-1/+1
| | | | | | | | | | | | | | | | | | | | Summary: This patch is a refactoring of the way cmake 'targets' are grouped. It won't affect non-UI cmake-generators. Clang/LLVM are using a structured way to group targets which ease navigation through Visual Studio UI. The Compiler-RT projects differ from the way Clang/LLVM are grouping targets. This patch doesn't contain behavior changes. Reviewers: kubabrecka, rnk Subscribers: wang0109, llvm-commits, kubabrecka, chrisha Differential Revision: http://reviews.llvm.org/D21952 llvm-svn: 275111
* [scudo] trying to fix the bot: aligned_alloc is not known there; attempt 3Kostya Serebryany2016-06-071-1/+1
| | | | llvm-svn: 272074
* [scudo] trying to fix the bot: aligned_alloc is not known there; attempt 2Kostya Serebryany2016-06-071-2/+3
| | | | llvm-svn: 272051
* [scudo] trying to fix the bot: aligned_alloc is not known thereKostya Serebryany2016-06-071-0/+2
| | | | llvm-svn: 272037
* [sanitizer] Initial implementation of a Hardened AllocatorKostya Serebryany2016-06-0714-0/+547
Summary: This is an initial implementation of a Hardened Allocator based on Sanitizer Common's CombinedAllocator. It aims at mitigating heap based vulnerabilities by adding several features to the base allocator, while staying relatively fast. The following were implemented: - additional consistency checks on the allocation function parameters and on the heap chunks; - use of checksum protected chunk header, to detect corruption; - randomness to the allocator base; - delayed freelist (quarantine), to mitigate use after free and overall determinism. Additional mitigations are in the works. Reviewers: eugenis, aizatsky, pcc, krasin, vitalybuka, glider, dvyukov, kcc Subscribers: kubabrecka, filcab, llvm-commits Differential Revision: http://reviews.llvm.org/D20084 llvm-svn: 271968
OpenPOWER on IntegriCloud