Commit Graph

80 Commits

Author SHA1 Message Date
Chandler Carruth 2946cd7010 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636
2019-01-19 08:50:56 +00:00
Kostya Kortchinsky 54764ca235 [sanitizer] Remove low-hanging-fruit dead code
Summary:
Going through the dead code findings, the code removed in this CL appears to be
pretty straightforward to remove, and seems to be some leftover from previous
refactors.

Reviewers: alekseyshl, eugenis

Reviewed By: alekseyshl

Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 330190
2018-04-17 14:54:50 +00:00
Reid Kleckner 222610bf10 [ASan] Report illegal instruction exceptions in ASan
Summary:
Respect the handle_sigill common flag and handle_segv flags while we're
at it.

We still handle signals/exceptions differently on Unix and Windows. The
installation process is tricky on Windows, and difficult to push down
into sanitizer_common without concerning it with the different
static/dynamic CRT models on Windows.

Reviewers: kcc, etienneb

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 277621
2016-08-03 18:13:14 +00:00
Mike Aizatsky 6d8a876159 [sancov] common flags initialization.
Summary:
Introducing InitializeCommonFlags accross all sanitizers to simplify
common flags management.

Setting coverage=1 when html_cov_report is requested.

Differential Revision: http://reviews.llvm.org/D18273

llvm-svn: 263820
2016-03-18 19:28:07 +00:00
Peter Collingbourne 5788e1259b Introduce stats and stats_client libraries.
This is part of a new statistics gathering feature for the sanitizers.
See clang/docs/SanitizerStats.rst for further info and docs.

Differential Revision: http://reviews.llvm.org/D16176

llvm-svn: 257972
2016-01-16 00:31:29 +00:00
Evgeniy Stepanov 7eeb02bd09 [asan] Read process name from /proc/self/cmdline on Linux.
Rename getBinaryBasename() to getProcessName() and, on Linux,
read it from /proc/self/cmdline instead of /proc/self/exe. The former
can be modified by the process. The main motivation is Android, where
application processes re-write cmdline to a package name. This lets
us setup per-application ASAN_OPTIONS through include=/some/path/%b.

llvm-svn: 243473
2015-07-28 20:27:51 +00:00
Evgeniy Stepanov df9ed542b5 [sanitizer] Implement include_if_exists with process name substitution.
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.

llvm-svn: 242853
2015-07-21 23:03:13 +00:00
Alexey Samsonov e6c614d48a [Sanitizer] Teach ReadFileToBuffer to distinguish empty file from inaccessible file.
Summary:
This fixes https://code.google.com/p/address-sanitizer/issues/detail?id=399
(sanitizers crash with empty suppression files).

Reviewers: kcc

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D11284

llvm-svn: 242594
2015-07-17 23:50:08 +00:00
Timur Iskhodzhanov 4eb084cda3 Use error_t rather than int in a couple of places where we handle files
llvm-svn: 234491
2015-04-09 14:49:53 +00:00
Dmitry Vyukov 2a80437038 tsan: add -Wno-maybe-uninitialized to mingw gcc build flags
As per discussion with David Blaikie here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150216/260289.html

llvm-svn: 229657
2015-02-18 09:37:31 +00:00
Dmitry Vyukov 78c25941ba tsan: fix compiler warning
mingw gcc complains:
warning: 'err' may be used uninitialized in this function [-Wmaybe-uninitialized]
       Printf("Failed to read options from '%s': error %d\n", value, err);

llvm-svn: 229392
2015-02-16 13:53:00 +00:00
Alexey Samsonov c9b0ea6eec [Sanitizer] Add "final" specifier to FlagHandlerBase::Parse overrides. NFC.
llvm-svn: 228893
2015-02-12 00:36:39 +00:00
Evgeniy Stepanov fbeb7e65d9 [asan] Warn if unsupported flags are used at activation.
llvm-svn: 226563
2015-01-20 12:19:14 +00:00
Evgeniy Stepanov 6c6e589c1f [sanitizer] Switch flag parsing to LowLevelAlloc.
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.

llvm-svn: 226453
2015-01-19 11:47:13 +00:00
Hal Finkel 0e39c55d22 [sanitizer] Adjust max read size in FlagHandlerInclude
Setting the maximum read size in FlagHandlerInclude to 2^15 might be a good
default, but causes the read to fail on systems with a page size larger than
that (ReadFileToBuffer(...) will fail if the maximum allowed size is less than
the value returned by GetPageSizeCached()). For example, on my PPC64/Linux
system, GetPageSizeCached() returns 2^16. In case the page size is larger, use
that instead.

llvm-svn: 226368
2015-01-17 03:31:43 +00:00
Evgeniy Stepanov 5450a9635a [sanitizer] Additional error checking.
llvm-svn: 226279
2015-01-16 15:25:16 +00:00
Evgeniy Stepanov bc14dd46f2 [sanitizer] Implement include= option.
Allows loading sanitizer options from file.

llvm-svn: 226175
2015-01-15 16:26:59 +00:00
Evgeniy Stepanov f294d5b829 [sanitizer] Flag parser rewrite.
The new parser is a lot stricter about syntax, reports unrecognized
flags, and will make it easier to implemented some of the planned features.

llvm-svn: 226169
2015-01-15 15:13:43 +00:00
Alexey Samsonov bdbdd3fd4e [Sanitizer] Use COMMON_FLAG macro to describe common runtime flags.
Summary:
Introduce a single place where we specify flag type, name, default
value, and description. This removes a large amount of boilerplate
and ensures we won't leave flags uninitialized.

Test Plan: regression test suite

Reviewers: kcc

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D6851

llvm-svn: 225239
2015-01-06 02:44:05 +00:00
Alexey Samsonov c426c337ed Revert "Revert r224736: "[Sanitizer] Make CommonFlags immutable after initialization.""
Fix test failures by introducing CommonFlags::CopyFrom() to make sure
compiler doesn't insert memcpy() calls into runtime code.

Original commit message:
Protect CommonFlags singleton by adding const qualifier to
common_flags() accessor. The only ways to modify the flags are
SetCommonFlagsDefaults(), ParseCommonFlagsFromString() and
OverrideCommonFlags() functions, which are only supposed to be
called during initialization.

llvm-svn: 225088
2015-01-02 21:28:37 +00:00
Kostya Serebryany a7ee2734cf [asan] add flag coverage_pcs. When false, the coverage is not dumped as PCs. Useful e.g. if the user only needs coverage is bitset
llvm-svn: 225002
2014-12-30 19:55:04 +00:00
Evgeniy Stepanov 9e609426a7 [sanitizer] Treat \r, \n, \t as flag separators.
llvm-svn: 224858
2014-12-26 16:09:15 +00:00
Kostya Serebryany 9fdeb37bd3 [asan] change the coverage collection scheme so that we can easily emit coverage for the entire process as a single bit set, and if coverage_bitset=1 actually emit that bitset
llvm-svn: 224789
2014-12-23 22:32:17 +00:00
Kostya Serebryany f053fc9b5c [sanitizer] initialize two flas in SetCommonFlagsDefaults
llvm-svn: 224645
2014-12-19 23:09:59 +00:00
Alexey Samsonov 2f8c8d59b2 [Sanitizer] Refactor CommonFlags interface. NFC.
Add CommonFlags::SetDefaults() and CommonFlags::ParseFromString(),
so that this object can be easily tested. Enforce
that ParseCommonFlagsFromString() and SetCommonFlagsDefaults()
work only with singleton CommonFlags, shared across all sanitizer
runtimes.

llvm-svn: 224617
2014-12-19 21:40:04 +00:00
Kostya Serebryany 43eb7735f2 [asan] new flag: hard_rss_limit_mb
llvm-svn: 224353
2014-12-16 19:13:01 +00:00
Yury Gribov ecfa592671 Removed r221896, it seems to break build in various ways.
llvm-svn: 221912
2014-11-13 19:37:30 +00:00
Yury Gribov 17072ef348 [ASan] Add process basename to log name and error message to simplify analysis of sanitized systems logs.
Reviewed at http://reviews.llvm.org/D5724

llvm-svn: 221896
2014-11-13 16:01:23 +00:00
Alexey Samsonov fbaaed6b58 [Sanitizer] Introduce "stack_trace_format" runtime flag.
This flag can be used to specify the format of stack frames - user
can now provide a string with placeholders, which should be printed
for each stack frame with placeholders replaced with actual data.
For example "%p" will be replaced by PC, "%s" will be replaced by
the source file name etc.

"DEFAULT" value enforces default stack trace format currently used in
all the sanitizers except TSan.

This change also implements __sanitizer_print_stack_trace interface
function in TSan.

llvm-svn: 221469
2014-11-06 18:43:45 +00:00
Alexey Samsonov 3ca50c34ec Add runtime flag 'symbolize_inline_frames' to disable symbolization of inlined frames done in llvm-symbolizer
llvm-svn: 220582
2014-10-24 18:34:43 +00:00
Evgeniy Stepanov f518a4e774 [asan] Add fast_unwind_on_check flag.
Allows to specify the unwinder to use for CHECK failures. Previous behaviour
was to use the "fatal" unwinder.
As compiler-rt is built without frame pointers, only the slow unwinder
really makes sense here, and it is the default.

llvm-svn: 219677
2014-10-14 09:36:24 +00:00
Alexey Samsonov 74f07ed7fe Revert r217616. Problems and complexity it introduces negate its benefit
llvm-svn: 217652
2014-09-12 01:26:57 +00:00
Alexey Samsonov 5d2c0dfe4c [UBSan] Parse common flags from UBSAN_OPTIONS runtime variable even if
UBSan is combined with ASan.

llvm-svn: 217616
2014-09-11 18:20:11 +00:00
Alexey Samsonov d2d2457823 [Sanitizer] Make disable_coredump a common flag and use it in TSan
llvm-svn: 215479
2014-08-12 22:07:48 +00:00
Alexey Samsonov 77f646c623 [Sanitizer] Make "suppressions" and "print_suppressions" common runtime flags.
No functionality change.

llvm-svn: 214343
2014-07-30 21:33:04 +00:00
Alexey Samsonov f723794da8 [Sanitizer] Remove SANITIZER_NEEDS_SEGV from shared sanitizer_common headers.
Otherwise, it can be accidentally redefined when we build specific sanitizer
runtime. This definition should be provided only once - when we build
sanitizer_common library.

llvm-svn: 212663
2014-07-09 23:59:40 +00:00
Evgeniy Stepanov 96f8edc720 [asan] Default to memory-mapped coverage on Android.
The alternative (writing coverage at process exit) is nearly useless there.

llvm-svn: 210024
2014-06-02 13:06:33 +00:00
Evgeniy Stepanov fa5c0750f0 [sanitizer] Add coverage_dir flag.
llvm-svn: 209815
2014-05-29 14:33:16 +00:00
Evgeniy Stepanov a0aa0f41d1 [sanitizer] Require that options end with '='.
llvm-svn: 209814
2014-05-29 14:32:32 +00:00
Evgeniy Stepanov 567e516015 [asancov] Write coverage directly to a memory-mapped file.
This way does not require a __sanitizer_cov_dump() call. That's
important on Android, where apps can be killed at arbitrary time.

We write raw PCs to disk instead of module offsets; we also write
memory layout to a separate file. This increases dump size by the
factor of 2 on 64-bit systems.

llvm-svn: 209653
2014-05-27 12:37:52 +00:00
Kostya Serebryany 7534a60753 [asan] Respect personality in kernel area detector, patch by Yuri Gribov
llvm-svn: 208760
2014-05-14 08:13:11 +00:00
Sergey Matveev f37bd92c3a [asan] Move the "coverage" flag to common flags.
The implementation lives in sanitizer_common and will need to access that flag.

llvm-svn: 208566
2014-05-12 14:27:36 +00:00
Kostya Serebryany 7afc6b2c72 [asan] enable use_sigaltstack by default (this will provide verbose reports on stack-overflow instead of silently crashing with SEGV)
llvm-svn: 207099
2014-04-24 11:55:17 +00:00
Kostya Serebryany c9db838267 [asan] enable LeakSanitizer (LSan) by default in asan. This only affects Linux x86_64. LSan has been used in various projects for more than half a year and we now consider it quite stable to be on by default.
llvm-svn: 206896
2014-04-22 13:56:56 +00:00
Kostya Serebryany 26c4e96455 [sanitizer] enable check_printf by default for asan and tsan. We've been using this flag for a while and it seems to be stable enough for the rest of the world.
llvm-svn: 206872
2014-04-22 09:17:08 +00:00
Kostya Serebryany bcfbea6d4e [asan] added internal flag mmap_limit_mb
llvm-svn: 206178
2014-04-14 14:51:01 +00:00
Kostya Serebryany 9f20c9b17c [asan] fix a leak in __tls_get_addr handler; introduce a run-time flag to disable this handler completely; remove a workaround for a bug fixed in glibc
llvm-svn: 205617
2014-04-04 09:10:58 +00:00
Timur Iskhodzhanov 59ce9e07a4 Fix a VS compile-time warning
warning C4345: behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized

llvm-svn: 204597
2014-03-24 10:47:37 +00:00
Alexander Potapenko 25e204e194 [libsanitizer] Add descriptions for the common flags.
Use new(allocator_for_flags) instead of allocator_for_flags.Allocate()
Fix the description output format a bit.

llvm-svn: 204484
2014-03-21 17:28:12 +00:00
Alexander Potapenko d23359c3e3 [libsanitizer] Implement IntrusiveList<T>::Iterator, use IntrusiveList in sanitizer_flags.cc
llvm-svn: 204342
2014-03-20 13:49:21 +00:00