[llvm] r332736 - [docs] Scudo documentation minor update
Kostya Kortchinsky via llvm-commits
llvm-commits at lists.llvm.org
Fri May 18 10:02:35 PDT 2018
Author: cryptoad
Date: Fri May 18 10:02:35 2018
New Revision: 332736
URL: http://llvm.org/viewvc/llvm-project?rev=332736&view=rev
Log:
[docs] Scudo documentation minor update
Summary:
Minor changes to reflect changes to the code that were not documented:
- `SCUDO_DEFAULT_OPTIONS` compile time way of defining options;
- MIPS added as a supported architecture;
- clarification on how to fully disable the Quarantine;
- rewording in a few places.
Reviewers: alekseyshl, flowerhack
Reviewed By: alekseyshl
Subscribers: sdardis, arichardson, atanasyan, llvm-commits
Differential Revision: https://reviews.llvm.org/D47071
Modified:
llvm/trunk/docs/ScudoHardenedAllocator.rst
Modified: llvm/trunk/docs/ScudoHardenedAllocator.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ScudoHardenedAllocator.rst?rev=332736&r1=332735&r2=332736&view=diff
==============================================================================
--- llvm/trunk/docs/ScudoHardenedAllocator.rst (original)
+++ llvm/trunk/docs/ScudoHardenedAllocator.rst Fri May 18 10:02:35 2018
@@ -18,7 +18,8 @@ Currently, the allocator supports (was t
- i386 (& i686) (32-bit);
- x86_64 (64-bit);
- armhf (32-bit);
-- AArch64 (64-bit).
+- AArch64 (64-bit);
+- MIPS (32-bit & 64-bit).
The name "Scudo" has been retained from the initial implementation (Escudo
meaning Shield in Spanish and Portuguese).
@@ -87,7 +88,7 @@ Randomness
----------
It is important for the allocator to not make use of fixed addresses. We use
the dynamic base option for the SizeClassAllocator, allowing us to benefit
-from the randomness of mmap.
+from the randomness of the system memory mapping functions.
Usage
=====
@@ -111,14 +112,14 @@ You may also build Scudo like this:
cd $LLVM/projects/compiler-rt/lib
clang++ -fPIC -std=c++11 -msse4.2 -O2 -I. scudo/*.cpp \
- $(\ls sanitizer_common/*.{cc,S} | grep -v "sanitizer_termination\|sanitizer_common_nolibc") \
- -shared -o scudo-allocator.so -pthread
+ $(\ls sanitizer_common/*.{cc,S} | grep -v "sanitizer_termination\|sanitizer_common_nolibc\|sancov_\|sanitizer_unwind\|sanitizer_symbol") \
+ -shared -o libscudo.so -pthread
and then use it with existing binaries as follows:
.. code::
- LD_PRELOAD=`pwd`/scudo-allocator.so ./a.out
+ LD_PRELOAD=`pwd`/libscudo.so ./a.out
Clang
-----
@@ -130,15 +131,20 @@ Scudo will also enforce PIE for the outp
Options
-------
-Several aspects of the allocator can be configured through the following ways:
+Several aspects of the allocator can be configured on a per process basis
+through the following ways:
+
+- at compile time, by defining ``SCUDO_DEFAULT_OPTIONS`` to the options string
+ you want set by default;
- by defining a ``__scudo_default_options`` function in one's program that
returns the options string to be parsed. Said function must have the following
- prototype: ``extern "C" const char* __scudo_default_options(void)``.
+ prototype: ``extern "C" const char* __scudo_default_options(void)``, with a
+ default visibility. This will override the compile time define;
- through the environment variable SCUDO_OPTIONS, containing the options string
to be parsed. Options defined this way will override any definition made
- through ``__scudo_default_options``;
+ through ``__scudo_default_options``.
The options string follows a syntax similar to ASan, where distinct options
can be assigned in the same string, separated by colons.
@@ -167,7 +173,9 @@ The following options are available:
| | | | the actual deallocation of chunks. Lower value |
| | | | may reduce memory usage but decrease the |
| | | | effectiveness of the mitigation; a negative |
-| | | | value will fallback to the defaults. |
+| | | | value will fallback to the defaults. Setting |
+| | | | *both* this and ThreadLocalQuarantineSizeKb to |
+| | | | zero will disable the quarantine entirely. |
+-----------------------------+----------------+----------------+------------------------------------------------+
| QuarantineChunksUpToSize | 2048 | 512 | Size (in bytes) up to which chunks can be |
| | | | quarantined. |
@@ -175,7 +183,9 @@ The following options are available:
| ThreadLocalQuarantineSizeKb | 1024 | 256 | The size (in Kb) of per-thread cache use to |
| | | | offload the global quarantine. Lower value may |
| | | | reduce memory usage but might increase |
-| | | | contention on the global quarantine. |
+| | | | contention on the global quarantine. Setting |
+| | | | *both* this and QuarantineSizeKb to zero will |
+| | | | disable the quarantine entirely. |
+-----------------------------+----------------+----------------+------------------------------------------------+
| DeallocationTypeMismatch | true | true | Whether or not we report errors on |
| | | | malloc/delete, new/free, new/delete[], etc. |
@@ -188,7 +198,6 @@ The following options are available:
+-----------------------------+----------------+----------------+------------------------------------------------+
Allocator related common Sanitizer options can also be passed through Scudo
-options, such as ``allocator_may_return_null``. A detailed list including those
-can be found here:
+options, such as ``allocator_may_return_null`` or ``abort_on_error``. A detailed
+list including those can be found here:
https://github.com/google/sanitizers/wiki/SanitizerCommonFlags.
-
More information about the llvm-commits
mailing list