Kostya Serebryany
cd60ed53f6
[asan] when reporting an ODR violation, also print the stack traces where the globals have been registered (thus show the name of shared library or exe to which the global belongs). The reports become a bit too verbose but I do not see any *simple* way to make them more compact. This should be especially helpful when the ODR happens because the same .cc file is used twice in the project in differend DSOs
...
llvm-svn: 211343
2014-06-20 08:24:12 +00:00
Timur Iskhodzhanov
86e2470a5b
[ASan/Win] Enable demangling of global variable names
...
llvm-svn: 208775
2014-05-14 13:55:59 +00:00
Kostya Serebryany
d7992fc921
[asan] fix a self deadlock when printing stats; add a relevant test, cleanup that test while at it to remove linux/darwin differences. Fixes http://code.google.com/p/address-sanitizer/issues/detail?id=306
...
llvm-svn: 208525
2014-05-12 08:01:51 +00:00
Kostya Serebryany
e91930a7e6
[asan] implement an experimental detector of ODR violations. Not tested yet outside of a tiny test, may need tuning.
...
llvm-svn: 207210
2014-04-25 08:58:28 +00:00
Kostya Serebryany
38bb53b2c5
[asan] add a run-time flag detect_container_overflow=true/false
...
llvm-svn: 206753
2014-04-21 14:18:45 +00:00
Kostya Serebryany
90527cb324
[asan] don't use bool in public interface, make sure the interface headers are usable in plain C
...
llvm-svn: 206160
2014-04-14 11:16:53 +00:00
Kostya Serebryany
f694ab1f18
[asan] provide better reports for cases where memcpy/etc get negative size parameter. Also fix a typo found by Tetsuo Kiso
...
llvm-svn: 206158
2014-04-14 09:50:52 +00:00
Kostya Serebryany
796f6557bf
[asan] *experimental* implementation of invalid-pointer-pair detector (finds when two unrelated pointers are compared or subtracted). This implementation has both false positives and false negatives and is not tuned for performance. A bug report for a proper implementation will follow.
...
llvm-svn: 202389
2014-02-27 12:45:36 +00:00
Joerg Sonnenberger
9d09e2fe90
Reapply r201910. MSVC gets __func__ defined explicitly, even though it
...
can't build anything here.
llvm-svn: 202297
2014-02-26 20:33:22 +00:00
Reid Kleckner
324eee45a7
Revert "Replace __FUNCTION__ with __func__, the latter being standard C99/C++11."
...
This reverts commit r201910.
While __func__ may be standard in C++11, it was only recently added to
MSVC in 2013 CTP, and LLVM supports MSVC 2012. __FUNCTION__ may not be
standard, but it's *very* portable.
llvm-svn: 201916
2014-02-22 00:37:45 +00:00
Joerg Sonnenberger
b15779f307
Replace __FUNCTION__ with __func__, the latter being standard C99/C++11.
...
llvm-svn: 201910
2014-02-21 23:55:15 +00:00
Evgeniy Stepanov
cba008e9c5
[asan] A different way of detectinb stack overflow.
...
Instead of checking stack limits that are not well defined for the main thread,
we rely on siginfo::si_code and distance from SP.
llvm-svn: 201673
2014-02-19 13:40:41 +00:00
Evgeniy Stepanov
2274ba7716
[asan] Improve stack overflow detection.
...
There are more cases when those manifest as an access below SP.
llvm-svn: 201664
2014-02-19 11:02:46 +00:00
Evgeniy Stepanov
65b959afad
[asan] Stack overflow detection.
...
Report segmentation faults near or below stack bottom as stack-overflow
(not stack-buffer-overflow!).
llvm-svn: 201565
2014-02-18 11:49:52 +00:00
Alexander Potapenko
0b28ea9c47
[libsanitizer] Create SanitizerCommonDecorator which provides the Warning() and EndWarning() methods
...
(needed for SEGV handling in sanitizer_common)
llvm-svn: 201392
2014-02-14 08:59:42 +00:00
Evgeniy Stepanov
769d46f373
[sanitizer] Use system unwinder in signal handlers on Android.
...
Because of the way Bionic sets up signal stack frames, libc unwinder is unable
to step through it, resulting in broken SEGV stack traces.
Luckily, libcorkscrew.so on Android implements an unwinder that can start with
a signal context, thus sidestepping the issue.
llvm-svn: 201151
2014-02-11 13:38:57 +00:00
Kostya Serebryany
336d97146a
[asan] increase the buffer size for printing asan legend, add a test for legend
...
llvm-svn: 200387
2014-01-29 11:12:09 +00:00
Evgeniy Stepanov
20513c0937
[asan] More buffering in report printing.
...
llvm-svn: 199888
2014-01-23 11:51:03 +00:00
Evgeniy Stepanov
631bd92292
[asan] Print shadow memory and legend as a single printf call.
...
llvm-svn: 199878
2014-01-23 10:52:33 +00:00
Evgeniy Stepanov
4819d28e53
[asan] clang-format part of asan_report.cc
...
llvm-svn: 199877
2014-01-23 10:49:47 +00:00
Kostya Serebryany
a650116adb
[asan] convert a CHECK failure in __sanitizer_annotate_contiguous_container into a proper warning message
...
llvm-svn: 197899
2013-12-23 07:01:43 +00:00
Alexey Samsonov
f2c7659cf8
[ASan] Get rid of ASan-specific functions for printing stack traces
...
llvm-svn: 197672
2013-12-19 11:25:05 +00:00
Kostya Serebryany
67968632ba
[asan] rename contiguous-container-buffer-overflow (too long) to container-overflow
...
llvm-svn: 195352
2013-11-21 12:23:52 +00:00
Kostya Serebryany
7b664299f0
[asan] new shadow poison magic for contiguous-container-buffer-overflow, addressed Alexey Samsonov's comments for r195011
...
llvm-svn: 195117
2013-11-19 08:40:07 +00:00
Alexey Samsonov
9ff4598225
[ASan] Do not rely on malloc context in allocator reports.
...
Invoke a fatal stack trace unwinder when ASan prints allocator-relevant
error reports (double-free, alloc-dealloc-mismatch, invalid-free).
Thus we'll be able to print complete stack trace even if allocation/free
stacks are not stored (malloc_context_size=0).
Based on the patch by Yuri Gribov!
llvm-svn: 194579
2013-11-13 14:46:58 +00:00
Alexey Samsonov
5dc6cff06a
[Sanitizer] Unify summary reporting across all sanitizers.
...
This change unifies the summary printing across sanitizers:
now each tool uses specific version of ReportErrorSummary() method,
which deals with symbolization of the top frame and formatting a
summary message. This change modifies the summary line for ASan+LSan mode:
now the summary mentions "AddressSanitizer" instead of "LeakSanitizer".
llvm-svn: 193864
2013-11-01 17:02:14 +00:00
Alexey Samsonov
590fe110f9
[Sanitizer] Revert r193501 and properly fix r193448
...
llvm-svn: 193522
2013-10-28 16:31:39 +00:00
Timur Iskhodzhanov
a1d048acb7
Work around ASan/Win breakage by r193448
...
llvm-svn: 193501
2013-10-27 13:37:23 +00:00
Peter Collingbourne
791e65dcfb
Overhaul the symbolizer interface.
...
This moves away from creating the symbolizer object and initializing the
external symbolizer as separate steps. Those steps now always take place
together.
Sanitizers with a legacy requirement to specify their own symbolizer path
should use InitSymbolizer to initialize the symbolizer with the desired
path, and GetSymbolizer to access the symbolizer. Sanitizers with no
such requirement (e.g. UBSan) can use GetOrInitSymbolizer with no need for
initialization.
The symbolizer interface has been made thread-safe (as far as I can
tell) by protecting its member functions with mutexes.
Finally, the symbolizer interface no longer relies on weak externals, the
introduction of which was probably a mistake on my part.
Differential Revision: http://llvm-reviews.chandlerc.com/D1985
llvm-svn: 193448
2013-10-25 23:03:29 +00:00
Nick Lewycky
d27d668342
Make sure ASan always emits an error summary if it reports an error.
...
llvm-svn: 193229
2013-10-23 06:19:04 +00:00
Kostya Serebryany
9628839869
[asan] reduce the size of AsanThreadContext by storing the stack trace in the stack depot
...
llvm-svn: 192979
2013-10-18 14:50:44 +00:00
Alexey Samsonov
df6e6569c0
[ASan] Don't die with internal ASan error on large buffer overflows
...
Summary:
Out-of-bound access may touch not-yet allocated or already freed
and recycled from quarantine chunks. We should treat this situation as
a "free-range memory access" and avoid printing any data about that
irrelevant chunk (which may be inconsistent).
This should fix https://code.google.com/p/address-sanitizer/issues/detail?id=183
Reviewers: kcc
Reviewed By: kcc
CC: timurrrr, llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1893
llvm-svn: 192581
2013-10-14 11:13:54 +00:00
Alexey Samsonov
f2b811a618
Refactor the usage of strip_path_prefix option and make it more consistent across sanitizers
...
llvm-svn: 191943
2013-10-04 08:55:03 +00:00
Alexey Samsonov
48e256466a
[ASan] Check that getSymbolizer() is defined. Turn magic mapping constants into named variables
...
llvm-svn: 190787
2013-09-16 15:45:06 +00:00
Kostya Serebryany
729c8dc65b
[asan] fully re-implement the FakeStack (use-after-return) to make it faster and async-signal-safe. The implementation is not yet complete (see FIXMEs) but the existing tests pass.
...
llvm-svn: 190588
2013-09-12 07:11:58 +00:00
Alexey Samsonov
7a36e6126b
[Sanitizer] Refactor symbolization interface: use class instead of several functions. Move some code around to get rid of extra source files
...
llvm-svn: 190410
2013-09-10 14:36:16 +00:00
Timur Iskhodzhanov
190784b21b
[ASan] Don't crash in DescribeHeapAddress if we don't know the current thread's ID
...
Also make DescribeThread easier to use.
This was firing on Dr.ASan runs, not sure how to repro InvalidTID in a simple test.
llvm-svn: 190392
2013-09-10 08:36:21 +00:00
Timur Iskhodzhanov
2b8d35f8ac
[asan] Hopefully fix the RTL build on Windows (part 2)
...
llvm-svn: 189817
2013-09-03 15:09:21 +00:00
Kostya Serebryany
14b7caca13
[asan] attemping to fix the Windows build
...
llvm-svn: 189814
2013-09-03 14:53:02 +00:00
Kostya Serebryany
6bafcd1949
implement PR17059: more visible diagnostics for stack-buffer-overflow
...
llvm-svn: 189806
2013-09-03 13:58:04 +00:00
Sergey Matveev
b9d34443f2
[lsan] Colorize LSan reports.
...
llvm-svn: 189804
2013-09-03 13:31:03 +00:00
Kostya Serebryany
8d42228e47
fix PR17061 (and pleeease, don't ask me for a test, this is just a minor output formatting issue :)
...
llvm-svn: 189783
2013-09-03 09:44:56 +00:00
Timur Iskhodzhanov
10286e1e59
[ASan/RTL] Disable colored reporting on Windows
...
llvm-svn: 188545
2013-08-16 11:26:26 +00:00
Timur Iskhodzhanov
eee13914e2
Define SANITIZER_INTERFACE_ATTRIBUTE on Windows and fix all the places where SANITIZER_INTERFACE_ATTRIBUTE or SANITIZER_ATTRIBUTE_WEAK are used
...
llvm-svn: 188261
2013-08-13 11:42:45 +00:00
Kostya Serebryany
6a068a715d
[asan] initialize fake_stack lazily and increase its maximal size. This makes -fsanitize=address,use-after-return more robust: all SPEC tests pass now. In the default mode thread stacks become a bit smaller.
...
llvm-svn: 184934
2013-06-26 12:16:05 +00:00
Timur Iskhodzhanov
cc61eefd4b
Fix MSVC W3 compiler warnings
...
llvm-svn: 182857
2013-05-29 14:11:44 +00:00
Kostya Serebryany
6ca6ba2f2c
[asan] fix the reported PCs for powerpc64
...
llvm-svn: 182477
2013-05-22 14:21:34 +00:00
Sergey Matveev
0c8ed9ce44
[asan] Common flags in ASan.
...
Some flags that are common to ASan/MSan/TSan/LSan have been moved to
sanitizer_common.
llvm-svn: 181193
2013-05-06 11:27:58 +00:00
Alexey Samsonov
46cc45a291
[ASan] Symbolize correct address when printint error summary
...
llvm-svn: 179274
2013-04-11 11:45:04 +00:00
Alexey Samsonov
c0443c5d25
[ASan] fix a typo in legend in error report
...
llvm-svn: 179161
2013-04-10 07:00:25 +00:00