[sanitizer] Implement a __asan_default_options() equivalent for Scudo
authorKostya Serebryany <kcc@google.com>
Tue, 2 Aug 2016 22:25:38 +0000 (22:25 +0000)
committerKostya Serebryany <kcc@google.com>
Tue, 2 Aug 2016 22:25:38 +0000 (22:25 +0000)
commit707894b09270dc072f734d2a28567db58bc36b34
treebf3f73c3a537a22d2dca6dcbfc260992a142ba8c
parent979902b3ff9009b5909ae245baf43d15f470e22b
[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
compiler-rt/lib/scudo/scudo_allocator.cpp
compiler-rt/lib/scudo/scudo_flags.cpp
compiler-rt/lib/scudo/scudo_termination.cpp
compiler-rt/lib/scudo/scudo_utils.cpp
compiler-rt/test/scudo/options.cpp [new file with mode: 0644]
llvm/docs/ScudoHardenedAllocator.rst