Skip to content

Commit b550090

Browse files
author
Kostya Kortchinsky
committed
[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 llvm-svn: 332736
1 parent 86e1283 commit b550090

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

llvm/docs/ScudoHardenedAllocator.rst

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ Currently, the allocator supports (was tested on) the following architectures:
1818
- i386 (& i686) (32-bit);
1919
- x86_64 (64-bit);
2020
- armhf (32-bit);
21-
- AArch64 (64-bit).
21+
- AArch64 (64-bit);
22+
- MIPS (32-bit & 64-bit).
2223

2324
The name "Scudo" has been retained from the initial implementation (Escudo
2425
meaning Shield in Spanish and Portuguese).
@@ -87,7 +88,7 @@ Randomness
8788
----------
8889
It is important for the allocator to not make use of fixed addresses. We use
8990
the dynamic base option for the SizeClassAllocator, allowing us to benefit
90-
from the randomness of mmap.
91+
from the randomness of the system memory mapping functions.
9192

9293
Usage
9394
=====
@@ -111,14 +112,14 @@ You may also build Scudo like this:
111112
112113
cd $LLVM/projects/compiler-rt/lib
113114
clang++ -fPIC -std=c++11 -msse4.2 -O2 -I. scudo/*.cpp \
114-
$(\ls sanitizer_common/*.{cc,S} | grep -v "sanitizer_termination\|sanitizer_common_nolibc") \
115-
-shared -o scudo-allocator.so -pthread
115+
$(\ls sanitizer_common/*.{cc,S} | grep -v "sanitizer_termination\|sanitizer_common_nolibc\|sancov_\|sanitizer_unwind\|sanitizer_symbol") \
116+
-shared -o libscudo.so -pthread
116117
117118
and then use it with existing binaries as follows:
118119

119120
.. code::
120121
121-
LD_PRELOAD=`pwd`/scudo-allocator.so ./a.out
122+
LD_PRELOAD=`pwd`/libscudo.so ./a.out
122123
123124
Clang
124125
-----
@@ -130,15 +131,20 @@ Scudo will also enforce PIE for the output binary.
130131

131132
Options
132133
-------
133-
Several aspects of the allocator can be configured through the following ways:
134+
Several aspects of the allocator can be configured on a per process basis
135+
through the following ways:
136+
137+
- at compile time, by defining ``SCUDO_DEFAULT_OPTIONS`` to the options string
138+
you want set by default;
134139

135140
- by defining a ``__scudo_default_options`` function in one's program that
136141
returns the options string to be parsed. Said function must have the following
137-
prototype: ``extern "C" const char* __scudo_default_options(void)``.
142+
prototype: ``extern "C" const char* __scudo_default_options(void)``, with a
143+
default visibility. This will override the compile time define;
138144

139145
- through the environment variable SCUDO_OPTIONS, containing the options string
140146
to be parsed. Options defined this way will override any definition made
141-
through ``__scudo_default_options``;
147+
through ``__scudo_default_options``.
142148

143149
The options string follows a syntax similar to ASan, where distinct options
144150
can be assigned in the same string, separated by colons.
@@ -167,15 +173,19 @@ The following options are available:
167173
| | | | the actual deallocation of chunks. Lower value |
168174
| | | | may reduce memory usage but decrease the |
169175
| | | | effectiveness of the mitigation; a negative |
170-
| | | | value will fallback to the defaults. |
176+
| | | | value will fallback to the defaults. Setting |
177+
| | | | *both* this and ThreadLocalQuarantineSizeKb to |
178+
| | | | zero will disable the quarantine entirely. |
171179
+-----------------------------+----------------+----------------+------------------------------------------------+
172180
| QuarantineChunksUpToSize | 2048 | 512 | Size (in bytes) up to which chunks can be |
173181
| | | | quarantined. |
174182
+-----------------------------+----------------+----------------+------------------------------------------------+
175183
| ThreadLocalQuarantineSizeKb | 1024 | 256 | The size (in Kb) of per-thread cache use to |
176184
| | | | offload the global quarantine. Lower value may |
177185
| | | | reduce memory usage but might increase |
178-
| | | | contention on the global quarantine. |
186+
| | | | contention on the global quarantine. Setting |
187+
| | | | *both* this and QuarantineSizeKb to zero will |
188+
| | | | disable the quarantine entirely. |
179189
+-----------------------------+----------------+----------------+------------------------------------------------+
180190
| DeallocationTypeMismatch | true | true | Whether or not we report errors on |
181191
| | | | malloc/delete, new/free, new/delete[], etc. |
@@ -188,7 +198,6 @@ The following options are available:
188198
+-----------------------------+----------------+----------------+------------------------------------------------+
189199

190200
Allocator related common Sanitizer options can also be passed through Scudo
191-
options, such as ``allocator_may_return_null``. A detailed list including those
192-
can be found here:
201+
options, such as ``allocator_may_return_null`` or ``abort_on_error``. A detailed
202+
list including those can be found here:
193203
https://github.com/google/sanitizers/wiki/SanitizerCommonFlags.
194-

0 commit comments

Comments
 (0)