summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [scudo][standalone] Make tests work on FuchsiaKostya Kortchinsky2019-11-271-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This CL makes unit tests compatible with Fuchsia's zxtest. This required a few changes here and there, but also unearthed some incompatibilities that had to be addressed. A header is introduced to allow to account for the zxtest/gtest differences, some `#if SCUDO_FUCHSIA` are used to disable incompatible code (the 32-bit primary, or the exclusive TSD). It also brought to my attention that I was using `__scudo_default_options` in different tests, which ended up in a single binary, and I am not sure how that ever worked. So move this to the main cpp. Additionally fully disable the secondary freelist on Fuchsia as we do not track VMOs for secondary allocations, so no release possible. With some modifications to Scudo's BUILD.gn in Fuchsia: ``` [==========] 79 tests from 23 test cases ran (10280 ms total). [ PASSED ] 79 tests ``` Reviewers: mcgrathr, phosek, hctim, pcc, eugenis, cferris Subscribers: srhines, jfb, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D70682
* scudo: Switch from std::random_shuffle to std::shuffle in a test.Peter Collingbourne2019-11-191-1/+2
| | | | | | This lets the test build with C++17. Differential Revision: https://reviews.llvm.org/D70471
* [scudo][standalone] Add a free list to the SecondaryKostya Kortchinsky2019-10-301-8/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The secondary allocator is slow, because we map and unmap each block on allocation and deallocation. While I really like the security benefits of such a behavior, this yields very disappointing performance numbers on Android for larger allocation benchmarks. So this change adds a free list to the secondary, that will hold recently deallocated chunks, and (currently) release the extraneous memory. This allows to save on some memory mapping operations on allocation and deallocation. I do not think that this lowers the security of the secondary, but can increase the memory footprint a little bit (RSS & VA). The maximum number of blocks the free list can hold is templatable, `0U` meaning that we fallback to the old behavior. The higher that number, the higher the extra memory footprint. I added default configurations for all our platforms, but they are likely to change in the near future based on needs and feedback. Reviewers: hctim, morehouse, cferris, pcc, eugenis, vitalybuka Subscribers: mgorny, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D69570
* [scudo][standalone] Get statistics in a char bufferKostya Kortchinsky2019-10-091-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Following up on D68471, this CL introduces some `getStats` APIs to gather statistics in char buffers (`ScopedString` really) instead of printing them out right away. Ultimately `printStats` will just output the buffer, but that allows us to potentially do some work on the intermediate buffer, and can be used for a `mallocz` type of functionality. This allows us to pretty much get rid of all the `Printf` calls around, but I am keeping the function in for debugging purposes. This changes the existing tests to use the new APIs when required. I will add new tests as suggested in D68471 in another CL. Reviewers: morehouse, hctim, vitalybuka, eugenis, cferris Reviewed By: morehouse Subscribers: delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D68653 llvm-svn: 374173
* compiler-rt: Rename .cc file in lib/scudo/standalone/tests to .cppNico Weber2019-08-011-0/+137
Like r367463, but for scudo/standalone/tests. With this, all files in compiler-rt/lib have extension cpp. llvm-svn: 367569
OpenPOWER on IntegriCloud