summaryrefslogtreecommitdiff
path: root/lib/scudo/standalone
Commit message (Collapse)AuthorAgeFilesLines
* [compiler-rt] Set the ZX_VMO_RESIZABLE option for zx_vmo_createPetr Hosek2019-05-021-1/+1
| | | | | | | | | | | | | Currently VMO in Zircon create using the zx_vmo_create is resizable by default, but we'll be changing this in the future, requiring an explicit flag to make the VMO resizable. Prepare for this change by passing ZX_VMO_RESIZABLE option to all zx_vmo_create calls that need resizable VMO. Differential Revision: https://reviews.llvm.org/D61450 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@359803 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt][tests] Propagate COMPILER_RT_UNITTEST_LINK_FLAGSHubert Tong2019-05-011-1/+1
| | | | | | | | | | | | | | | | | | | | | `COMPILER_RT_UNITTEST_LINK_FLAGS` is dropped in many places, unlike `COMPILER_RT_UNITTEST_CFLAGS`. This patch attempts to remove that inconsistency. Previously reviewed as part of D58951. Reviewers: sfertile, peter.smith, pzheng, phosek, Hahnfeld, nemanjai, jasonliu Reviewed By: sfertile Subscribers: jsji, kubamracek, dberris, mgorny, delcypher, jdoerfert, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D60143 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@359733 91177308-0d34-0410-b5e6-96231b3b80d8
* [scudo][standalone] Add the memory reclaiming mechanismKostya Kortchinsky2019-04-306-3/+527
| | | | | | | | | | | | | | | | | | | | | | Summary: This CL implements the memory reclaiming function `releaseFreeMemoryToOS` and its associated classes. Most of this code was originally written by Aleksey for the Primary64 in sanitizer_common, and I made some changes to be able to implement 32-bit reclaiming as well. The code has be restructured a bit to accomodate for freelist of batches instead of the freearray used in the current sanitizer_common code. Reviewers: eugenis, vitalybuka, morehouse, hctim Reviewed By: vitalybuka Subscribers: srhines, mgorny, delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D61214 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@359567 91177308-0d34-0410-b5e6-96231b3b80d8
* [scudo][standalone] Introduce the SizeClassMapKostya Kortchinsky2019-04-255-1/+190
| | | | | | | | | | | | | | | | | | | | | | Summary: As with the sanitizer_common allocator, the SCM allows for efficient mapping between sizes and size-classes, table-free. It doesn't depart significantly from the original, except that we allow the use of size-class 0 for other purposes (as opposed to chunks of size 0). The Primary will use it to hold TransferBatches. Reviewers: vitalybuka, eugenis, hctim, morehouse Reviewed By: vitalybuka Subscribers: srhines, mgorny, delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D61088 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@359199 91177308-0d34-0410-b5e6-96231b3b80d8
* [scudo][standalone] Introduce the Secondary allocatorKostya Kortchinsky2019-04-2414-88/+476
| | | | | | | | | | | | | | | | | | | | | | | | Summary: The Secondary allocator wraps the platform allocation primitives. It is meant to be used for larger sizes that the Primary can't fullfill, as it will be slower, and sizes are multiple of the system page size. This also changes some of the existing code, notably the opaque platform data being passed to the platform specific functions: we can shave a couple of syscalls on Fuchsia by storing additional data (this addresses a TODO). Reviewers: eugenis, vitalybuka, hctim, morehouse Reviewed By: morehouse Subscribers: mgorny, delcypher, jfb, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D60787 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@359097 91177308-0d34-0410-b5e6-96231b3b80d8
* [scudo][standalone] Add flags & related parsersKostya Kortchinsky2019-04-099-0/+510
| | | | | | | | | | | | | | | | | | | | | | | Summary: As with other Sanitizers, and the current version of Scudo, we can provide flags in differents way: at compile time, through a weak function, through an environment variable. This change adds support for the configuration flags, and the string parsers. Those are fairly similar to the sanitizer_common way of doing things. Reviewers: morehouse, hctim, vitalybuka Reviewed By: morehouse, vitalybuka Subscribers: mgorny, delcypher, jdoerfert, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D59597 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@358011 91177308-0d34-0410-b5e6-96231b3b80d8
* [scudo][standalone] Add error reportsKostya Kortchinsky2019-03-206-37/+339
| | | | | | | | | | | | | | | | | | | | | Summary: This change adds fatal error messages for various error conditions that will be added later in the code. This also addresses a `TODO` now that we have `reportCheckFailed` (which lead me to notice a few variables that were not cased properly so I changed that as well). Reviewers: morehouse, hctim, vitalybuka Reviewed By: morehouse, hctim, vitalybuka Subscribers: mgorny, delcypher, jfb, jdoerfert, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D59551 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@356556 91177308-0d34-0410-b5e6-96231b3b80d8
* [scudo][standalone] Add string utility functionsKostya Kortchinsky2019-03-197-13/+385
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add some string utility functions, notably to format strings, get lengths, convert a string to a number. Those functions will be used in reports and flags (coming up next). They were mostly borrowed from sanitizer_common. Make use of the string length function in a couple places in the platform code that was checked in with inlined version of it. Add some tests. Reviewers: morehouse, eugenis, vitalybuka, hctim Reviewed By: morehouse, vitalybuka Subscribers: mgorny, delcypher, jdoerfert, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D59262 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@356457 91177308-0d34-0410-b5e6-96231b3b80d8
* [scudo][standalone] Implement checksumming functionsKostya Kortchinsky2019-03-126-0/+216
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This CL implements the checksumming functions. This departs from the current Scudo code in one aspect: the software version is no longer CRC32 but a BSD checksum. This is because the software CRC32 was too impactful in terms of performances, the BSD checksum has no array lookup which is better (and saves 1KB of data). As with the current version, we only flip the CRC compiler flag for a single compilation unit by default, to allow for a library compiled with HW CRC32 to work on a system without HW CRC32. There is some platform & hardware specific code in those files, but since departs from a mere platform split, it felt right to me to have it that way. Reviewers: morehouse, eugenis, vitalybuka, hctim, mcgrathr Reviewed By: morehouse Subscribers: mgorny, delcypher, jfb, jdoerfert, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D59116 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@355923 91177308-0d34-0410-b5e6-96231b3b80d8
* [scudo][standalone] Adding a stats classKostya Kortchinsky2019-03-074-0/+152
| | | | | | | | | | | | | | | | | | | | Summary: This adds simple local & global stats classes to be used by the Primary and Secondary, and associated test. Note that we don't need the strict atomicity of the addition & subtraction (as is in sanitizer_common) so we just use load & store. Reviewers: morehouse, vitalybuka, eugenis, flowerhack, dmmoore415 Reviewed By: morehouse, vitalybuka Subscribers: mgorny, delcypher, jfb, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D59031 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@355643 91177308-0d34-0410-b5e6-96231b3b80d8
* [scudo][standalone] Add bytemap classesKostya Kortchinsky2019-03-054-0/+178
| | | | | | | | | | | | | | | | | | | | Summary: The bytemap classes will be used by the primary32 allocator to associate classes with memory regions. It's similar to the sanitizer_common one except for the fact that the base (level1) maps are mapped instead of being static to reduce the memory footprint of an uninitialized allocator. Reviewers: vitalybuka, eugenis, morehouse, flowerhack, dmmoore415, mcgrathr Reviewed By: vitalybuka, morehouse Subscribers: mgorny, delcypher, jfb, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D58723 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@355416 91177308-0d34-0410-b5e6-96231b3b80d8
* [scudo][standalone] Fix tests makefileKostya Kortchinsky2019-03-011-2/+2
| | | | | | | | | | | | | | | | | | | | | Summary: A missing `STATIC` entailed some annoying to debug failures wrt 32 vs 64 binaries. Additionally I noticed I was using the wrong variable (the Scudo one as opposed to the Scudo Standalone one). See https://reviews.llvm.org/D58184#1412417 and below for discussion. Reviewers: vitalybuka, eugenis, brzycki Reviewed By: vitalybuka, brzycki Subscribers: mgorny, delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D58794 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@355203 91177308-0d34-0410-b5e6-96231b3b80d8
* [scudo][standalone] Add a standalone vector classKostya Kortchinsky2019-02-275-4/+167
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This CL adds a standalone vector class that will be used by the scoped strings when they land. We reimplement our own vector class because we can't use the std library one. It's mostly borrowed from the current sanitizer_common one, with LLVM code style changes. Additionnally a casing change in a function name that slipped through the previous review (the function isn't used yet). Reviewers: vitalybuka, eugenis, flowerhack, dmmoore415, mcgrathr, morehouse Reviewed By: vitalybuka Subscribers: mgorny, delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D58689 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@354999 91177308-0d34-0410-b5e6-96231b3b80d8
* [scudo][standalone] Introduce platform specific code & mutexesKostya Kortchinsky2019-02-2615-52/+986
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This CL adds the platform specific code for Fuchsia, Linux & Android, as well as some tests related to those (more tests to come later). While some of it is pretty much a straight port of the existing scudo & sanitizer_common code, the memory mapping functions have been reworked a bit to fit the limited usage scenario that Scudo has for them. For Fuchsia, I can now track the Vmar/Vmo pair for memory mappings if there is an intent to grow or decommit some mapping (that will be useful for the Primary). Reviewers: eugenis, vitalybuka, mcgrathr, phosek, flowerhack, morehouse, dmmoore415 Reviewed By: vitalybuka, morehouse Subscribers: kcc, dvyukov, srhines, mgorny, delcypher, jfb, jdoerfert, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D58184 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@354895 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt] Cleanup usage of C++ ABI libraryJonas Hahnfeld2019-02-161-1/+5
| | | | | | | | | | | | | Add missed value "libcxxabi" and introduce SANITIZER_TEST_CXX for linking unit tests. This needs to be a full C++ library and cannot be libcxxabi. Recommit r354132 which I reverted in r354153 because it broke a sanitizer bot. This was because of the "fixes" for pthread linking, so I've removed these changes. Differential Revision: https://reviews.llvm.org/D58012 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@354198 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[compiler-rt] Cleanup usage of C++ ABI library"Jonas Hahnfeld2019-02-151-4/+1
| | | | | | | This reverts r354132 because it breaks sanitizer-x86_64-linux: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/19915 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@354153 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt] Cleanup usage of C++ ABI libraryJonas Hahnfeld2019-02-151-1/+4
| | | | | | | | | Add missed value "libcxxabi" and introduce SANITIZER_TEST_CXX for linking unit tests. This needs to be a full C++ library and cannot be libcxxabi. Differential Revision: https://reviews.llvm.org/D58012 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@354132 91177308-0d34-0410-b5e6-96231b3b80d8
* [scudo][standalone] Do not error out on spurious C(XX) flagsKostya Kortchinsky2019-02-071-1/+3
| | | | | | | | | | | | | | | | | | | | | | Summary: The standalone Scudo version is being built with `-Werror` which can be tripped by extraneous command line arguments. We have little control over those as they can be passed down to us by `CMAKE_C(XX)_FLAGS`, the reported scenario involving `-stdlib=libc++` (see https://reviews.llvm.org/D57412#1384504). To work around this, disable `-Wunused-command-line-argument`. Reviewers: eugenis, vitalybuka, Eugene.Zelenko Reviewed By: eugenis Subscribers: mgorny, delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D57757 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@353418 91177308-0d34-0410-b5e6-96231b3b80d8
* [scudo] Initial standalone skeleton check-inKostya Kortchinsky2019-02-0410-0/+917
Summary: This is the initial check-in for the Standalone version of Scudo. The project is initially going to live in scudo/standalone then will replace scudo. See http://lists.llvm.org/pipermail/llvm-dev/2019-January/129113.html for details. This initial CL is meant to lay out the project structure, of both code & tests, providing a minimal amount of functionalities, namely various definitions, some atomic helpers and an intrusive list. (empty.cc is just here to have a compilation unit, but will go away in the upcoming CLs). Initial support is restricted to Linux i386 & x86_64 in make files and will be extended once things land & work. We will grow organically from here, adding functionalities in limited amounts. Reviewers: morehouse, eugenis, vitalybuka, kcc, mcgrathr, flowerhack Reviewed By: morehouse, vitalybuka Subscribers: srhines, mgorny, krytarowski, delcypher, jfb, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D57412 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@353055 91177308-0d34-0410-b5e6-96231b3b80d8