summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/lang/cpp/namespace/main.cpp
diff options
context:
space:
mode:
authorKostya Kortchinsky <kostyak@google.com>2017-07-24 15:29:38 +0000
committerKostya Kortchinsky <kostyak@google.com>2017-07-24 15:29:38 +0000
commit2d94405a32b05e0343090e7f16f9fd1112c66b9d (patch)
tree48a88834ad36f8f9340fbcfc2ff367036b74a169 /lldb/packages/Python/lldbsuite/test/lang/cpp/namespace/main.cpp
parentf189cb79d4d532ed2abe44b7076399120621719d (diff)
downloadbcm5719-llvm-2d94405a32b05e0343090e7f16f9fd1112c66b9d.tar.gz
bcm5719-llvm-2d94405a32b05e0343090e7f16f9fd1112c66b9d.zip
[scudo] Quarantine overhaul
Summary: First, some context. The main feedback we get about the quarantine is that it's too memory hungry. A single MB of quarantine will have an impact of 3 to 4MB of PSS/RSS, and things quickly get out of hand in terms of memory usage, and the quarantine ends up disabled. The main objective of the quarantine is to protect from use-after-free exploitation by making it harder for an attacker to reallocate a controlled chunk in place of the targeted freed chunk. This is achieved by not making it available to the backend right away for reuse, but holding it a little while. Historically, what has usually been the target of such attacks was objects, where vtable pointers or other function pointers could constitute a valuable targeti to replace. Those are usually on the smaller side. There is barely any advantage in putting the quarantine several megabytes of RGB data or the like. Now for the patch. This patch introduces a new way the Quarantine behaves in Scudo. First of all, the size of the Quarantine will be defined in KB instead of MB, then we introduce a new option: the size up to which (lower than or equal to) a chunk will be quarantined. This way, we only quarantine smaller chunks, and the size of the quarantine remains manageable. It also prevents someone from triggering a recycle by allocating something huge. We default to 512 bytes on 32-bit and 2048 bytes on 64-bit platforms. In details, the patches includes the following: - introduce `QuarantineSizeKb`, but honor `QuarantineSizeMb` if set to fall back to the old behavior (meaning no threshold in that case); `QuarantineSizeMb` is described as deprecated in the options descriptios; documentation update will follow; - introduce `QuarantineChunksUpToSize`, the new threshold value; - update the `quarantine.cpp` test, and other tests using `QuarantineSizeMb`; - remove `AllocatorOptions::copyTo`, it wasn't used; - slightly change the logic around `quarantineOrDeallocateChunk` to accomodate for the new logic; rename a couple of variables there as well; Rewriting the tests, I found a somewhat annoying bug where non-default aligned chunks would account for more than needed when placed in the quarantine due to `<< MinAlignment` instead of `<< MinAlignmentLog`. This is fixed and tested for now. Reviewers: alekseyshl, kcc Reviewed By: alekseyshl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D35694 llvm-svn: 308884
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/lang/cpp/namespace/main.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud