1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

[sanitizer] Implement a __asan_default_options() equivalent for Scudo

Summary:
Currently, the Scudo Hardened Allocator only gets its flags via the SCUDO_OPTIONS environment variable.
With this patch, we offer the opportunity for programs to define their own options via __scudo_default_options() which behaves like __asan_default_options() (weak symbol).
A relevant test has been added as well, and the documentation updated accordingly.
I also used this patch as an opportunity to rename a few variables to comply with the LLVM naming scheme, and replaced a use of Report with dieWithMessage for consistency (and to avoid a callback).

Reviewers: llvm-commits, kcc

Differential Revision: https://reviews.llvm.org/D23018

llvm-svn: 277536
This commit is contained in:
Kostya Serebryany 2016-08-02 22:25:38 +00:00
parent 6944286a7c
commit a9a5306a06

View File

@ -89,10 +89,33 @@ functions.
Options
-------
Several aspects of the allocator can be configured through environment options,
following the usual ASan options syntax, through the variable SCUDO_OPTIONS.
Several aspects of the allocator can be configured through the following ways:
- 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()``.
- 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;
The options string follows a syntax similar to ASan, where distinct options
can be assigned in the same string, separated by colons.
For example, using the environment variable:
.. code::
SCUDO_OPTIONS="DeleteSizeMismatch=1:QuarantineSizeMb=16" ./a.out
Or using the function:
.. code::
extern "C" const char *__scudo_default_options() {
return "DeleteSizeMismatch=1:QuarantineSizeMb=16";
}
For example: SCUDO_OPTIONS="DeleteSizeMismatch=1:QuarantineSizeMb=16".
The following options are available: