summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/scudo/standalone/secondary.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [scudo][standalone] Add a free list to the SecondaryKostya Kortchinsky2019-10-301-116/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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] Consolidate listsKostya Kortchinsky2019-10-281-21/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is a clean patch using the last diff of D69265, but using git instead of svn, since svn went ro and arc was making my life harded than it needed to be. I was going to introduce a couple more lists and realized that our lists are currently a bit all over the place. While we have a singly linked list type relatively well defined, we are using doubly linked lists defined on the fly for the stats and for the secondary blocks. This CL adds a doubly linked list object, reorganizing the singly list one to extract as much of the common code as possible. We use this new type in the stats and the secondary. We also reorganize the list tests to benefit from this consolidation. There are a few side effect changes such as using for iterator loops that are, in my opinion, cleaner in a couple of places. Reviewers: hctim, morehouse, pcc, cferris Reviewed By: hctim Subscribers: jfb, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D69516
* [scudo][standalone] Get statistics in a char bufferKostya Kortchinsky2019-10-091-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [scudo][standalone] Minor correctionsKostya Kortchinsky2019-08-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Few corrections with no functional change: - replacing `%zd` with `%zu` all around: the values are unsigned - prefer `MAP_ANONYMOUS` to `MAP_ANON` (it's deprecated) - remove the unused `enum LinkerInitialized` - mark a parameter as `UNUSED` in Fuchsia's `getRandom` - correct the casing of a variable and use `nullptr` instead of 0 for pointers in `list.h` - reorder some `typedef` to be consistent between `signed` and `unsigned` Reviewers: eugenis, vitalybuka, morehouse, hctim Reviewed By: vitalybuka, morehouse Subscribers: delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D65660 llvm-svn: 368585
* compiler-rt: Rename .cc file in lib/scudo/standalone to .cppNico Weber2019-08-011-0/+134
Like r367463, but for scudo/standalone. llvm-svn: 367568
OpenPOWER on IntegriCloud