summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_flag_parser.h
AgeCommit message (Collapse)Author
2017-08-21[sanitizer] Do not over-dup string flagsKostya Kortchinsky
Summary: String flags values appear to be duped twice. Once in `FlagParser::parse_flag` using the `LowLevelAllocator` via `ll_strndup`, once in `FlagHandler<const char *>::Parse` using the `InternalAllocator` via `internal_strdup`. It looks like the second one is redundant, as the memory for the first one is never freed and not used for anything else. Assigning the value to the flag instead of duping it has a few advantages: - if it was the only use of the `InternalAllocator` (which is the case for Scudo), then the related code will not be compiled it, which saves us a whole instantiation of the CombinedAllocator worth of extra code; - in the event a string flag is parsed, the `InternalAllocator` would have created a whole SizeClassAllocator32 region for a single allocation, which is kind of wasteful. - also, the string is dup'ed twice for the whole lifetime of a process. I tested check-{sanitizer,asan,tsan,ubsan,scudo} successfully, so as far as I can tell this doesn't appear to have bad side effects. Reviewers: eugenis, alekseyshl Reviewed By: eugenis Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D36970 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@311386 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-25[compiler-rt] Replace allow_user_segv_handler=0 with kHandleSignalExclusiveVitaly Buka
Summary: allow_user_segv_handler had confusing name did not allow to control behavior for signals separately. Reviewers: eugenis, alekseyshl, kcc Subscribers: llvm-commits, dberris, kubamracek Differential Revision: https://reviews.llvm.org/D33371 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303941 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19[compiler-rt] Switch handle_<signal> flags from bool to enum.Vitaly Buka
Summary: We are going to make it tri-state and remove allow_user_segv_handler. Reviewers: eugenis, alekseys, kcc Subscribers: kubamracek, dberris, llvm-commits Differential Revision: https://reviews.llvm.org/D33159 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303464 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06Revert r299672: Add a virtual destructor to a class with virtual methods.Ivan Krasin
Reason: breaks sanitizers builds. Original Differential Revision: https://reviews.llvm.org/D317 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@299679 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06Add a virtual destructor to a class with virtual methods.Ivan Krasin
Summary: Recently, Clang enabled the check for virtual destructors in the presence of virtual methods. That broke the bootstrap build. Fixing it. Reviewers: pcc Reviewed By: pcc Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D31776 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@299672 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21[sanitizer] Implement include_if_exists with process name substitution.Evgeniy Stepanov
include_if_exists=/path/to/sanitizer/options reads flags from the file if it is present. "%b" in the include file path (for both variants of the flag) is replaced with the basename of the main executable. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@242853 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-12[Sanitizer] Add "final" specifier to FlagHandlerBase::Parse overrides. NFC.Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@228893 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19[sanitizer] Make unrecognized flags not fatal.Evgeniy Stepanov
Print a warning at verbosity=1 and higher instead of dying immediately. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@226458 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19[sanitizer] Switch flag parsing to LowLevelAlloc.Evgeniy Stepanov
InternalAlloc is quite complex and its behavior may depend on the values of flags. As such, it should not be used while parsing flags. Sadly, LowLevelAlloc does not support deallocation of memory. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@226453 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15[sanitizer] Implement include= option.Evgeniy Stepanov
Allows loading sanitizer options from file. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@226175 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15[sanitizer] Flag parser rewrite.Evgeniy Stepanov
The new parser is a lot stricter about syntax, reports unrecognized flags, and will make it easier to implemented some of the planned features. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@226169 91177308-0d34-0410-b5e6-96231b3b80d8