Alexey Samsonov
c0ff933d8b
[ASan] Move error reporting code away from file with interceptors
...
llvm-svn: 161570
2012-08-09 08:32:33 +00:00
Alexey Samsonov
b4b316fc5b
[ASan] Move error reports away from ASan allocator. Add new source file to CMakeLists as well
...
llvm-svn: 161569
2012-08-09 08:15:46 +00:00
Alexey Samsonov
aa05110a17
[ASan] Create new files asan_report.{h,cc} as a preparation for refactoring of ASan error reporting code.
...
Currently ASan reports many kinds of errors, and the code that actually prints error messages can
be found inside allocator, OS-specific files, interceptors code etc.
An example of maintenance troubles this situation causes:
There is currently an ASan interface function that registers
callback which should take the char buffer with error report printed by ASan.
This function is now broken, as one has to insert callback calls to all the places in
ASan code where the error reports are printed, surprisingly it is not only
"__asan_report_error" function...
llvm-svn: 161568
2012-08-09 07:40:58 +00:00
Alexey Samsonov
4750230ac6
[Sanitizer] cleanup CMake files for interception and sanitizer_common helper libraries
...
llvm-svn: 161485
2012-08-08 09:46:51 +00:00
Alexey Samsonov
0317b8bbc0
[ASan] simplify cmake rules for adding lit testsuites
...
llvm-svn: 161412
2012-08-07 11:09:41 +00:00
Alexey Samsonov
1e6c947a4c
[ASan] add llvm_tools_dir to lit.site.cfg for ASan and add it to PATH
...
llvm-svn: 161411
2012-08-07 11:00:19 +00:00
Alexey Samsonov
59c33c0c9a
[ASan] Add support for running unit tests by lit (as a part of 'make check-asan' command)
...
llvm-svn: 161406
2012-08-07 08:59:15 +00:00
Alexey Samsonov
941a6ec9bb
[ASan] fix names of malloc/free replacements on Android
...
llvm-svn: 161322
2012-08-06 15:13:22 +00:00
Alexey Samsonov
0295edbfd5
[ASan] add new ASan option 'strip_path_prefix' to remove useless prefices from filenames in stack traces
...
llvm-svn: 161321
2012-08-06 13:00:21 +00:00
Alexander Potapenko
8f6dd3537c
AllocationSize(ptr) should check that |ptr| actually points to the beginning of the chunk it belongs to.
...
Fixes http://code.google.com/p/address-sanitizer/issues/detail?id=86
llvm-svn: 161320
2012-08-06 12:24:39 +00:00
Alexander Potapenko
879b1ffca7
Implement LinuxSymbolizer instead of symbolize_addr2line.
...
llvm-svn: 161181
2012-08-02 14:58:04 +00:00
Alexander Potapenko
be84ac8ff3
Some refactoring for asan_symbolize.py: introduced the Symbolizer class and implemented DarwinSymbolizer for atos-based symbolization, BreakpadSymbolizer for breakpad-based symbolization (files produced by the dump_syms tool, http://code.google.com/p/google-breakpad/source/browse/#svn%2Ftrunk%2Fsrc%2Ftools%2Fmac%2Fdump_syms ) and ChainSymbolizer to allow falling back if a symbolizer hadn't succeeded.
...
Fixed pylint warnings.
llvm-svn: 161176
2012-08-02 13:59:23 +00:00
Alexey Samsonov
2e62a9a765
[Sanitizer] fix windows build
...
llvm-svn: 161170
2012-08-02 11:38:58 +00:00
Alexey Samsonov
9d74295078
Follow-up for r161168 for Windows
...
llvm-svn: 161169
2012-08-02 11:29:14 +00:00
Alexey Samsonov
0f840bd240
[Sanitizer] Workaround for a compiler warning - ISO C++ forbids casting pointer-to-function to pointer-to-object, so we use cast via integral type
...
llvm-svn: 161168
2012-08-02 11:19:13 +00:00
Alexander Potapenko
33824c54f6
Make strcat() and strncat() more standard-compliant (check for invalid parameters even if zero bytes is copied, more accurate overlap check)
...
Fix the tests that were relying on the incorrect behavior.
llvm-svn: 161167
2012-08-02 10:25:46 +00:00
Alexey Samsonov
ce8d497aaf
[Sanitizer] Fix warnings to please cmake build
...
llvm-svn: 161166
2012-08-02 10:09:31 +00:00
Alexander Potapenko
40b48ccae2
Add support for "movsbl %sil,%ecx" (x86_64) and "movsbl $imm(%ebp), %edx" (i386) to our fork of mach_override.
...
This is an extended version of a patch by Rafael Avila de Espindola (rafael.espindola@gmail.com )
llvm-svn: 161116
2012-08-01 16:35:48 +00:00
Alexey Samsonov
139a7c0575
[Sanitizer] Make ASan/TSan sources depend on headers from interception library
...
llvm-svn: 161113
2012-08-01 14:55:49 +00:00
Alexey Samsonov
cc7ea4269a
[ASan] cleanup interceptors code - prefer ASAN_INTERCEPT_FUNCTION_NAME macro to _WIN32, __APPLE__ etc.
...
llvm-svn: 161109
2012-08-01 11:17:00 +00:00
Alexey Samsonov
7b2f36e96a
First tiny move towards integrating AddressSanitizer regressions test into LLVM lit-based testing infrastructure.
...
The goal is to be able to run ASan tests by simply running "make check-asan" command from CMake build tree:
* tests should use fresh clang binary from current build tree.
* tests should use the same RUN-lines syntax as llvm/clang reg tests.
Next steps:
- restricting tests to machines where target is equal to host, i.e. where we can produce working binaries.
- moving AddressSanitizer unit tests to lit as well.
llvm-svn: 161050
2012-07-31 15:43:11 +00:00
Alexander Potapenko
8aae9557d6
Factor out the main() function.
...
llvm-svn: 161046
2012-07-31 13:51:26 +00:00
Alexey Samsonov
500e99639d
[Sanitizer] Wrapper around llvm::DIContext from LLVM DebugInfo library. If a macro SANITIZER_USES_LLVM_LIBS is defined (by default it is not), then sanitizer runtime includes llvm headers and tries to use LLVM libs for in-process symbolization. To make it functional, we have to link with these LLVM libs - either pass them to linker from Clang driver, or link them into static ASan runtime when we build it.
...
llvm-svn: 161045
2012-07-31 11:51:26 +00:00
Alexey Samsonov
36d2dff143
[ASan] fix cmake build warning
...
llvm-svn: 160957
2012-07-30 10:18:31 +00:00
Alexey Samsonov
a2e0cf4802
[TSan] delete trailing spaces
...
llvm-svn: 160955
2012-07-30 07:46:09 +00:00
Dmitry Vyukov
904d3f9c06
tsan: add ReleaseStore() function that merely copies vector clock rather than combines two clocks
...
fix clock setup for finalizer goroutine (Go runtime)
llvm-svn: 160918
2012-07-28 15:27:41 +00:00
Dmitry Vyukov
55253100be
tsan: add missing include
...
llvm-svn: 160875
2012-07-27 18:13:03 +00:00
Dmitry Vyukov
4e94662db4
tsan: change event handling from single HandleEvent() to a set of separate functions (Go runtime)
...
llvm-svn: 160863
2012-07-27 14:00:39 +00:00
Dmitry Vyukov
536551d02d
tasn: do not remember stack traces for sync objects for Go (they are not reported anyway)
...
llvm-svn: 160861
2012-07-27 13:21:33 +00:00
Dmitry Vyukov
e91e9ac2a2
tsan: remove unnecessary and wrong include
...
llvm-svn: 160860
2012-07-27 13:21:01 +00:00
Kostya Serebryany
4c38790f70
[asan] ensure that asan_init is called in str[n]cmp. Bug found by Nick Kralevich (thanks)
...
llvm-svn: 160853
2012-07-27 07:09:49 +00:00
Dmitry Vyukov
65ec6684c2
tsan: make the runtime library name tsan-neutral for Go upstream
...
llvm-svn: 160797
2012-07-26 18:42:51 +00:00
Dmitry Vyukov
55b405ef42
tsan: allow environment to override OnReport() and OverrideFlags()
...
llvm-svn: 160728
2012-07-25 14:30:51 +00:00
Dmitry Vyukov
dfc8e52400
tsan: suport for Go finalizers
...
llvm-svn: 160723
2012-07-25 13:16:35 +00:00
Dmitry Vyukov
d654f06644
tsan: expect that Go symbolizer can return NULLs
...
llvm-svn: 160722
2012-07-25 11:50:37 +00:00
Alexey Samsonov
5062359502
cmake for compiler-rt: add a function to set output dirs for compiler runtimes equal to directory used by Clang driver. Use it for ASan runtime. Also, make sure that ASan unit tests depend on the ASan runtime.
...
llvm-svn: 160721
2012-07-25 11:15:00 +00:00
Kostya Serebryany
bb0ade6daa
[asan] don't return from a never-return function. fix a test that had a chain of bugs instead of just one
...
llvm-svn: 160719
2012-07-25 10:56:09 +00:00
Alexey Samsonov
c145b02607
[ASan] fixup for r160712: provide a default definition for weak __asan_default_options()
...
llvm-svn: 160718
2012-07-25 10:40:57 +00:00
Alexander Potapenko
9bac1cedbc
Make __asan_default_options a weak function that returns a const char*.
...
Users may define it to override the default ASan options.
This function has to be marked with __attribute__((no_address_safety_analysis)), because it is called before ASan is fully initialized.
Add an output test checking the __asan_default_options functionality.
llvm-svn: 160712
2012-07-25 09:18:43 +00:00
Dmitry Vyukov
bcf0b7002b
tsan: align report style with Go internal format
...
llvm-svn: 160672
2012-07-24 12:29:43 +00:00
Alexey Samsonov
65d842ae51
Revert r160669 (except for compile flag updates)
...
llvm-svn: 160671
2012-07-24 12:11:38 +00:00
Dmitry Vyukov
69bee8d8f6
tsan: output goroutine creation stack
...
llvm-svn: 160670
2012-07-24 12:03:47 +00:00
Alexey Samsonov
3397013606
[ASan] hacking cmake build: after generating asan runtime, copy it to the Clang lib directory where Clang driver expects to find it.
...
llvm-svn: 160669
2012-07-24 11:49:55 +00:00
Alexey Samsonov
96b9393f2d
[ASan] Support for cmake build of ASan unittests in 32-bit LLVM build. Currently, to run ASan unit tests both for 32- and 64 bits one has to maintain two distinct LLVM builds. In a bright future, we'd like to use a single build for this
...
llvm-svn: 160666
2012-07-24 08:26:19 +00:00
Alexander Potapenko
51e6488b31
Intercept CFAllocator for each thread in the program.
...
Test that child threads use the ASan allocator, that allocated memory can be passed to another thread and deallocated on it.
This should fix http://code.google.com/p/address-sanitizer/issues/detail?id=81
llvm-svn: 160630
2012-07-23 14:07:58 +00:00
Alexey Samsonov
37d5134f38
[ASan] minor fixes to silence cmake build warnings
...
llvm-svn: 160624
2012-07-23 09:11:58 +00:00
Alexander Potapenko
7f3e84c9fd
For wild addresses in the shadow or shadow gap areas print an error message instead of crashing on a check.
...
Add AddressSanitizer.MemsetWildAddressTest that makes sure a proper error message is printed.
llvm-svn: 160620
2012-07-23 08:22:27 +00:00
Alexey Samsonov
3735faa108
[ASan] subtract one from PCs in ASan error reports (as they originally contain return addresses). Make output tests stricter.
...
llvm-svn: 160508
2012-07-19 15:07:26 +00:00
Kostya Serebryany
7a32f8dcb8
[tsan] fix lint
...
llvm-svn: 160504
2012-07-19 12:22:04 +00:00
Kostya Serebryany
a415df6539
[tsan] minor fixes in tsan allocator and its testlib. Now runs fine with chrome
...
llvm-svn: 160503
2012-07-19 12:15:33 +00:00
Alexander Potapenko
628b349b17
Suppress the stderr output from atos.
...
llvm-svn: 160502
2012-07-19 12:01:07 +00:00
Alexey Samsonov
7acdc1738f
[Sanitizer] When obtaining the data for loaded modules, add address ranges of loadable segments only. Looks like address range of PT_TLS segment may intersect with loadable segments of other modules.
...
llvm-svn: 160498
2012-07-19 07:51:20 +00:00
Kostya Serebryany
ab34919413
[tsan] minor enhancements in the new tsan allocator and a test malloc replacement library that can be linked to any program to replace malloc (tested on spec2006)
...
llvm-svn: 160436
2012-07-18 16:04:55 +00:00
Alexey Samsonov
c6d97c0ad1
[TSan] fix confusing error message in CheckFailed
...
llvm-svn: 160435
2012-07-18 14:37:22 +00:00
Alexey Samsonov
4dbfad627e
[Sanitizer] add missing unit test for flag parsing (forgot to run svn add before)
...
llvm-svn: 160428
2012-07-18 06:29:18 +00:00
Alexey Samsonov
93ca829c2d
[TSan] cleanup header comments
...
llvm-svn: 160359
2012-07-17 09:39:59 +00:00
Kostya Serebryany
78713bc574
[asan] get rid of the last operator new call in asan rtl
...
llvm-svn: 160347
2012-07-17 07:20:13 +00:00
Dmitry Vyukov
f2bc464f37
tsan: add platform suffix to Go runtime library
...
llvm-svn: 160304
2012-07-16 18:25:43 +00:00
Dmitry Vyukov
3abd096370
tsan: treat malloc() as memory access in Go
...
llvm-svn: 160289
2012-07-16 16:55:01 +00:00
Dmitry Vyukov
5bfac97ff9
tsan: use dynamic shadow stack for Go
...
llvm-svn: 160288
2012-07-16 16:44:47 +00:00
Dmitry Vyukov
dc36d69b6a
tsan: increase number of dead threads for Go
...
llvm-svn: 160283
2012-07-16 16:03:16 +00:00
Dmitry Vyukov
9270eaf1f2
tsan: Go runtime: support goroutine end event
...
llvm-svn: 160282
2012-07-16 16:01:08 +00:00
Dmitry Vyukov
5e5e36712b
tsan: fix build
...
llvm-svn: 160267
2012-07-16 13:25:47 +00:00
Dmitry Vyukov
c40c00767c
tsan: port Go runtime to Darwin
...
llvm-svn: 160266
2012-07-16 13:02:40 +00:00
Alexey Samsonov
d77fbba74a
[Sanitizer] implement straightforward nlogn sorting, as qsort() may call malloc, which leads to deadlock in ASan allocator
...
llvm-svn: 160262
2012-07-16 11:27:17 +00:00
Dmitry Vyukov
263efd8f05
tsan: allow to pass CFLAGS to Go runtime build script
...
llvm-svn: 160259
2012-07-16 10:36:39 +00:00
Dmitry Vyukov
2dac24a42b
tsan: add missing test for Go runtime
...
llvm-svn: 160258
2012-07-16 10:34:57 +00:00
Kostya Serebryany
38f318bf20
[tsan] use internal_strnlen in strncpy interceptor (the bug found while booting chromium)
...
llvm-svn: 160171
2012-07-13 13:04:43 +00:00
Nick Kledzik
35293305b7
<rdar://problem/11668446> Add .subsections_via_symbols to Darwin assembly files
...
llvm-svn: 160062
2012-07-11 19:21:39 +00:00
Alexey Samsonov
2d4bd13eb6
[Sanitizer] fix CMake build
...
llvm-svn: 159988
2012-07-10 09:17:06 +00:00
Alexey Samsonov
9f666ea6ca
[ASan] move flags description to separate header, add comments about them.
...
llvm-svn: 159985
2012-07-10 07:41:27 +00:00
Alexey Samsonov
2467ca5010
[ASan] cleanup: remove dead flag
...
llvm-svn: 159934
2012-07-09 15:11:28 +00:00
Alexey Samsonov
34efb8e9b9
[ASan] Use common flags parsing machinery.
...
llvm-svn: 159933
2012-07-09 14:36:04 +00:00
Alexey Samsonov
2c94cd6e3d
[Sanitizer] move flag parsing routines (and unit tests) from tsan runtime to common runtime.
...
llvm-svn: 159928
2012-07-09 13:21:39 +00:00
Alexander Potapenko
b4e9fd297c
Suppress a lint warning.
...
llvm-svn: 159915
2012-07-08 15:00:06 +00:00
Dmitry Vyukov
239ae7186b
tsan: Go language support fixes
...
llvm-svn: 159856
2012-07-06 20:23:59 +00:00
Dmitry Vyukov
e0d31e9170
tsan: Go lang: symbolize stack traces
...
llvm-svn: 159827
2012-07-06 14:54:25 +00:00
Kostya Serebryany
739b0de5b1
[tsan] start using AllocatorCache in CombinedAllocator
...
llvm-svn: 159825
2012-07-06 14:32:00 +00:00
Alexander Potapenko
740d166c3e
Small fix: do not replace the default CFAllocator if it has been replaced already.
...
llvm-svn: 159824
2012-07-06 13:52:28 +00:00
Kostya Serebryany
d1e6094f9e
[tsan] implement SizeClassAllocatorLocalCache (part of tsan allocator)
...
llvm-svn: 159823
2012-07-06 13:46:49 +00:00
Alexander Potapenko
dc211a8db4
Because CFAllocatorCreate() should also be called after __CFInitialize() on Lion,
...
do so by factoring the CFAllocator logic into ReplaceCFAllocator(), which is called from
either the __CFInitialize wrapper or __asan_init(), depending on which of them is called later.
llvm-svn: 159822
2012-07-06 13:24:28 +00:00
Alexander Potapenko
89f9270366
A portable way to check whether __CFInitialize has been called: compare kCFAllocatorSystemDefault._base._cfisa to 0.
...
This should fix http://code.google.com/p/address-sanitizer/issues/detail?id=87 on both Lion and Snow Leopard.
llvm-svn: 159821
2012-07-06 13:04:12 +00:00
Alexander Potapenko
d2ff0b087a
Do not check for __CFRuntimeClassTableSize on non-10.6 systems, where this symbol is private.
...
This change may cause http://code.google.com/p/address-sanitizer/issues/detail?id=87 to re-appear on Lion.
llvm-svn: 159819
2012-07-06 11:58:54 +00:00
Kostya Serebryany
78e973fa6b
[tsan] use intrusive list in the new tsan allocator
...
llvm-svn: 159814
2012-07-06 09:26:01 +00:00
Kostya Serebryany
ff13537a94
[tsan] add intrusive list to be used in tsan allocator, etc
...
llvm-svn: 159812
2012-07-06 09:03:45 +00:00
Dmitry Vyukov
03d32ecd4f
tsan: Go language support
...
llvm-svn: 159754
2012-07-05 16:18:28 +00:00
Alexander Potapenko
25b567dd0d
Fix http://code.google.com/p/address-sanitizer/issues/detail?id=87 by making sure we replace the default CFAllocator only after __CFInitialize has been called.
...
llvm-svn: 159749
2012-07-05 14:46:56 +00:00
Alexey Samsonov
38b1ec4317
[ASan] Add a default constructor for DWARFSection to initialize it with zeros.
...
llvm-svn: 159748
2012-07-05 14:28:37 +00:00
Dmitry Vyukov
5dc3f01676
tsan/asan: kill STL
...
First, placement new from standard library conflicts with our own.
Second, we are in trouble if user uses the same function (we either get instrumented code in runtime, or non-instrumented code in user program).
llvm-svn: 159738
2012-07-05 09:23:37 +00:00
Kostya Serebryany
ba235522e0
[tsan] reg test for tsan issue #3
...
llvm-svn: 159737
2012-07-05 09:09:40 +00:00
Alexey Samsonov
78a3bbc82c
[TSan] add a new option 'use_internal_symbolizer' that allows to choose between addr2line-based and llvm-based symbolizer w/o having to rebuild the runtime. This is hopefully a temporary solution that simplifies testing process. In the end, we should leave a single symbolizer.
...
llvm-svn: 159730
2012-07-05 07:18:29 +00:00
Alexey Samsonov
b4ea34f5d7
[TSan] Improve output tests: allow reports to contain file:line:column instead of file:line
...
llvm-svn: 159714
2012-07-04 15:48:05 +00:00
Alexander Potapenko
77769caaef
Do not call malloc_zone_from_ptr() for the pointers passed to mz_size() and mz_free().
...
These callbacks assume that the memory belongs to asan_zone, so it's incorrect to pass it to another one.
If a need for this appears (e.g. system libraries free the memory using wrong zone), it should be documented.
llvm-svn: 159713
2012-07-04 13:58:07 +00:00
Alexey Samsonov
3ac4548c92
[ASan] Minor fix in symbolizer output.
...
llvm-svn: 159709
2012-07-04 10:58:35 +00:00
Alexey Samsonov
716aa7e2f2
[ASan] fixup for r159652
...
llvm-svn: 159655
2012-07-03 09:06:39 +00:00
Alexey Samsonov
961276af26
[Sanitizer] Extend a symbolizer code. Implemented for Linux only. Use dl_iterate_phdr to get virtual addresses of mapped module sections. To symbolize an address from a module, map this module to memory and obtain pointers to debug info sections. Later these pointers can be passed to constructor of DWARF context-in-memory from LLVM DebugInfo lib.
...
llvm-svn: 159652
2012-07-03 08:24:14 +00:00
Alexey Samsonov
6f510f8eb5
[TSan] use threadsafe death tests in TSan unit tests
...
llvm-svn: 159533
2012-07-02 14:35:25 +00:00
Dmitry Vyukov
b13099c26e
asan/tsan: improve SpinMutex
...
llvm-svn: 159518
2012-07-02 07:09:21 +00:00
Dmitry Vyukov
b462dfcaeb
tsan/asan: add mutex to 64-bit allocator
...
llvm-svn: 159516
2012-07-02 06:54:24 +00:00
Alexey Samsonov
4618508ea4
[ASan] cmake cleanup: make tab/space padding in CMakeLists consistent, silence/fix some pedantic warnings
...
llvm-svn: 159514
2012-07-02 06:48:10 +00:00
Dmitry Vyukov
3c5c9e7774
tsan/asan: third try on msvc atomics
...
llvm-svn: 159449
2012-06-29 18:37:45 +00:00
Dmitry Vyukov
b379fe51b4
tsan/asan: second attemp on msvc atomics
...
llvm-svn: 159447
2012-06-29 18:28:02 +00:00
Dmitry Vyukov
e8cee12ce2
tsan/asan: first try on msvc atomics
...
llvm-svn: 159443
2012-06-29 18:00:38 +00:00
Dmitry Vyukov
513f0238d8
tsan/asan: add SpinMutex to sanitizer_common
...
llvm-svn: 159439
2012-06-29 17:32:18 +00:00
Dmitry Vyukov
7a9fa7dbc5
tsan/asan: unify ScopedLock
...
llvm-svn: 159438
2012-06-29 17:10:08 +00:00
Dmitry Vyukov
6fa46f7003
tsan/asan: unify atomics (move atomics from tsan to sanitizer_common)
...
llvm-svn: 159437
2012-06-29 16:58:33 +00:00
Dmitry Vyukov
6967083071
tsan: use -Wno-unused-private-field only for clang (gcc does not understand it)
...
llvm-svn: 159435
2012-06-29 16:37:49 +00:00
Kostya Serebryany
92afdb6c31
[tsan] added CombinedAllocator for tsan
...
llvm-svn: 159432
2012-06-29 15:35:18 +00:00
Dmitry Vyukov
ef5a5a5650
tsan: replace struct copies where clang inserts memcpy() calls with explicit internal_memcpy() calls
...
llvm-svn: 159431
2012-06-29 15:26:55 +00:00
Dmitry Vyukov
5bb47a6e0e
tsan: remove own memset/memcpy/memcmp (too messy)
...
llvm-svn: 159430
2012-06-29 15:19:14 +00:00
Kostya Serebryany
5766a9e015
[asan] fix lint
...
llvm-svn: 159429
2012-06-29 14:14:32 +00:00
Kostya Serebryany
d32d537d63
[asan] get rid of libc's sscanf as it causes infinite recursion on Fedora.
...
llvm-svn: 159424
2012-06-29 13:05:36 +00:00
Alexey Samsonov
c37ac17629
[ASan] cmake unit tests: explicitly add necessary linker flags when linking unit tests with asan runtime
...
llvm-svn: 159420
2012-06-29 11:29:39 +00:00
Alexey Samsonov
548b7b5b0e
[ASan] cmake-based unit tests: merge instrumented and non-instrumented files into one test binary
...
llvm-svn: 159419
2012-06-29 10:23:31 +00:00
Dmitry Vyukov
a932bdfc1e
tsan: clear shadow for ucontext, because it's visible to user
...
llvm-svn: 159365
2012-06-28 18:20:50 +00:00
Dmitry Vyukov
fa985a02ef
tsan: fix crashes if signal is caught during thread bootstrap or shutdown
...
llvm-svn: 159361
2012-06-28 18:07:46 +00:00
Alexey Samsonov
6b03aa1bf7
[ASan] fix the build - erase second main as we link all test sources together
...
llvm-svn: 159348
2012-06-28 13:44:27 +00:00
Alexey Samsonov
3fe0d4d9aa
[ASan] silence various warnings in cmake build of asan unit tests
...
llvm-svn: 159347
2012-06-28 13:12:07 +00:00
Alexey Samsonov
b4edab5a6b
[ASan] cmake support for running asan unit tests on Mac
...
llvm-svn: 159345
2012-06-28 12:19:52 +00:00
Alexey Samsonov
ecf5436e9c
[ASan] update cmake rules so that ASan unit tests can include googletest (and, hence, llvm) headers when they are built by fresh Clang
...
llvm-svn: 159343
2012-06-28 09:32:19 +00:00
Dmitry Vyukov
e4df904770
tsan: add missing file (forgot to svn add in r159294)
...
llvm-svn: 159341
2012-06-28 09:04:45 +00:00
Alexey Samsonov
70386aaffa
[ASan] cleanup: trailing semicolons, trailing colons in enums
...
llvm-svn: 159338
2012-06-28 08:27:24 +00:00
Alexey Samsonov
fa42dd7ac4
[Sanitizer] fight more semicolons in macro definitions (to please mac cmake build)
...
llvm-svn: 159337
2012-06-28 08:07:19 +00:00
Dmitry Vyukov
090f345522
tsan: prevent insertion of unwanted memset/memcpy/memcmp into runtime
...
llvm-svn: 159294
2012-06-27 21:00:23 +00:00
Dmitry Vyukov
b94a8f0c39
tsan: remember and pass original ucontext to signal handlers (instead of a fabricated one)
...
llvm-svn: 159278
2012-06-27 17:35:35 +00:00
Dmitry Vyukov
97c26bdaea
tsan: refactor signal handling code (move some definitions out of common header)
...
llvm-svn: 159266
2012-06-27 16:05:06 +00:00
Dmitry Vyukov
d326a6cf93
tsan: check that signal handlers do not spoil errno.
...
llvm-svn: 159264
2012-06-27 13:54:46 +00:00
Dmitry Vyukov
f8b7a8dc08
tsan: close all file descriptors after fork()
...
llvm-svn: 159263
2012-06-27 12:48:46 +00:00
Chandler Carruth
9aaf156f30
Add support for building the ASan instrumentation unit tests with the
...
just-built Clang binary, and linking them against the just-built ASan
runtime.
This is *very* brittle. I expect it will require tweaking, and I've
pro-actively disabled it on non-Unix builds and on cross-builds.
It is also currently missing dependency edges on GoogleTest header files
and a few other corner cases, but those can be fixed. This is the major
milestone of a mini-bootstrap-like build of the unittest.
llvm-svn: 159255
2012-06-27 09:01:24 +00:00
Kostya Serebryany
4196046714
[tsan] added LargeMmapAllocator, a part of the new tsan allocator
...
llvm-svn: 159204
2012-06-26 14:23:32 +00:00
Alexey Samsonov
e2109388a4
[TSan] fix warnings suppression: internal-linkage-in-inline was renamed to static-in-inline
...
llvm-svn: 159198
2012-06-26 11:33:51 +00:00
Kostya Serebryany
c639b3943a
[asan] update the cmake file for asan
...
llvm-svn: 159143
2012-06-25 15:38:37 +00:00
Dmitry Vyukov
c598de93bd
tsan: remove internal allocator, switch to sanitizer_common one.
...
llvm-svn: 159142
2012-06-25 15:09:24 +00:00
Dmitry Vyukov
ec64f3e738
tsan: remove internal allocator, switch to sanitizer_common one.
...
llvm-svn: 159141
2012-06-25 15:03:15 +00:00
Kostya Serebryany
aad697eb8a
[tsan] lint
...
llvm-svn: 159140
2012-06-25 14:58:17 +00:00
Kostya Serebryany
100590f756
[tsan] minor changes in tsan allocator
...
llvm-svn: 159139
2012-06-25 14:53:49 +00:00
Kostya Serebryany
6bbb5140cc
[tsan] fix the build
...
llvm-svn: 159137
2012-06-25 14:31:59 +00:00
Kostya Serebryany
9ed4f506bb
[asan] move tests from asan_interface_test.cc to asan_noinst_test.cc. Now all these tests do not require instrumentation and work directly with asan rt
...
llvm-svn: 159135
2012-06-25 14:23:07 +00:00
Chandler Carruth
9359efa986
Cleanup the handling of CFLAGS even more in the cmake build for ASan.
...
Add the initial support for building ASan tests.
The first change here is to try to get the CFLAGS to more closely match
those used by the old Makefile. There are probably still goofs here,
ASan folks, your review would be appreciated.
The second big change is to add support for building both
instrumentation based an non-instrumentation based unittests for ASan.
They are built a bit differently from how the old makefiles managed
things. Specifically, there are two binaries, one for the
non-instrumented case, and one for the instrumented case.
Also, the instrumented unit tests rely on the host compiler supporting
AddressSanitizer's intrumentation pass. This is kind-of gross, but
I don't know of a better way yet. I've mailed llvmdev to discuss this
issue.
One big caveat is that the detection logic currently doesn't work. I've
commented it out temporarily as I'd like to get feedback from the ASan
developers, etc.
llvm-svn: 159134
2012-06-25 12:57:43 +00:00
Kostya Serebryany
0e0832bfdb
[asan] get rid of '#include <malloc.h>' in the implementation of malloc interceptors
...
llvm-svn: 159132
2012-06-25 09:58:29 +00:00
Chandler Carruth
c78ad00c07
Another big step toward a viable CMake build system for CompilerRT,
...
ASan, and friends.
This explicitly switches the CompilerRT CMake build to require CMake
version 2.8.8 or newer which provides first-class support for "object"
libraries which consist of a pile of '.o' files -- exactly what is
desired for composing runtime libraries. I've gone ahead and switched to
using this.
I've also added the interception library which I missed initially. And
I've added proper dependencies between the various libraries. With this,
I'm able to build archives for asan that appear to contain all of the
necessary .o files.
The final tweak here is to start setting up the compile flags and macro
defines expected by ASan and its helper libraries. These may not be
entirely correct currently, they're based loosely on my reading of the
old Makefiles. However, they can be tweaked more easily now that they're
wired up properly.
llvm-svn: 159129
2012-06-25 08:40:10 +00:00
Chandler Carruth
bbff278c9c
Lots of trivial changes to remove extraneous semicolons throughout ASan.
...
llvm-svn: 159128
2012-06-25 06:53:10 +00:00
Kostya Serebryany
f299f7013a
[tsan] a better CHECK for OOM in the new allocator
...
llvm-svn: 159122
2012-06-25 04:12:49 +00:00
Kostya Serebryany
875f99a6bf
[asan] fix -Wsign-compare
...
llvm-svn: 159083
2012-06-23 16:30:48 +00:00
Chandler Carruth
6e2bf8f2bb
Mechanical change to sink a #ifdef guard for a platform below the
...
include of int_lib.h.
The purpose of this change is to make the C code conform to the pedantic
rules of C99 -- an empty translation unit is not valid. It should have
absolutely no functional impact, and changes nothing about the built
libraries.
llvm-svn: 159034
2012-06-22 21:09:22 +00:00
Chandler Carruth
321916a76b
Remove extraneous semicolons outside of functions. This fixes a large
...
number of -pedantic warnings.
llvm-svn: 159033
2012-06-22 21:09:15 +00:00
Chandler Carruth
e80a289fdc
Reorder these things for clarity, and add -std=c99 to the compile flags.
...
llvm-svn: 159032
2012-06-22 21:09:10 +00:00
Kostya Serebryany
278ccdacdc
[tsan] add metadata to the new tsan allocator
...
llvm-svn: 159002
2012-06-22 16:13:28 +00:00
Stephen Canon
c3b81119a7
Allow divsi3 to take advantage of a hardware unsigned divide when it is available, by replacing an explicit call to udivsi3 with the divide operator. Patch by Sébastien Bourdeauducq.
...
llvm-svn: 158996
2012-06-22 14:44:13 +00:00
Kostya Serebryany
5b01415dc0
[tsan] more code for a specialized tsan allocator
...
llvm-svn: 158991
2012-06-22 13:00:50 +00:00
Dmitry Vyukov
de1fd1c83b
tsan: do not call malloc/free in memory access handling routine.
...
This improves signal-/fork-safety of instrumented programs.
llvm-svn: 158988
2012-06-22 11:08:55 +00:00
Alexander Potapenko
245f4ae59a
Small lint fix.
...
llvm-svn: 158922
2012-06-21 16:40:59 +00:00
Alexander Potapenko
70feed27ea
Add a test for issue 81 -- AddressSanitizerMac.DISABLED_CFAllocatorDefaultDoubleFree_ChildPhread
...
llvm-svn: 158921
2012-06-21 16:08:11 +00:00
Kostya Serebryany
6e26fa9dd1
[tsan] first step in implementing a custom allocator for tsan (and msan) which saves precious shadow
...
llvm-svn: 158913
2012-06-21 10:04:36 +00:00
Alexey Samsonov
f8947a3360
[ASan] fix lint error
...
llvm-svn: 158905
2012-06-21 08:13:49 +00:00
Alexander Potapenko
15b4cafd2c
Enable AddressSanitizerMac.CFAllocatorDefaultDoubleFree and AddressSanitizerMac.CFAllocatorMallocDoubleFree, which now work fine.
...
llvm-svn: 158886
2012-06-21 01:04:30 +00:00
Alexander Potapenko
1bde28b464
Factor the common code out of cf_free and mz_free.
...
Introduce the mac_ignore_invalid_free flag (0 by default) which makes both cf_free and mz_free ignore invalid free invocations and leak memory.
llvm-svn: 158885
2012-06-21 01:01:20 +00:00
Alexander Potapenko
642371724e
Fix the output tests on Darwin
...
llvm-svn: 158870
2012-06-20 23:07:55 +00:00
Alexander Potapenko
f9f2fbacb3
Actually intercept free() to ensure that the deallocations caused by other functions directly calling it are routed to our allocator.
...
For the allocations that do not belong to any malloc zone check whether they're padded with a pointer to ASan's CFAllocator. If so, free the original (unpadded) pointer.
This should fix AddressSanitizerMac.NSURLDeallocation and issue 70.
llvm-svn: 158863
2012-06-20 22:29:09 +00:00
Alexander Potapenko
50e788b724
Add a test for NSURL deallocation (issue 70)
...
llvm-svn: 158843
2012-06-20 20:28:39 +00:00
Kostya Serebryany
98390d0b71
[tsan] a bit more lint and Makefile changes to run tests from sanitizer_common
...
llvm-svn: 158821
2012-06-20 15:19:17 +00:00
Chandler Carruth
bf22bd21e9
Resuming work on the compiler-rt CMake build at long long last. In order
...
to get it working again, two changes were needed:
- I had to give up on glob-based file expansion. This just isn't well
supported by CMake, and until we convince upstream there of its value,
it's not worth dealing with the pain.
- Add the common library as otherwise even ASan won't build.
This now builds again, although the "correctness" of it is a touch
debatable. ;] Specifically, there is no merging of the common runtime
library with the asan runtime library into a single archive file. I'm
not really sure what the best technique is for that, and it may be
influenced by the ongoing discussion about how best to link runtime
libraries.
Note of course that this is still very much WIP. It doesn't entirely
work yet, and remains disabled by the LLVM projects/CMakeLists.txt until
it is in a working state.
llvm-svn: 158811
2012-06-20 10:18:43 +00:00
Alexey Samsonov
e1cb524226
[Sanitizer] Renaming: SNPrintf -> internal_snprintf (and move it to sanitizer libc)
...
llvm-svn: 158710
2012-06-19 09:21:57 +00:00
Alexey Samsonov
b1c3991915
[TSan] Add a comment that tsan_flags.h may be included in the user code, and therefore shouldn't include other headers from TSan or common sanitizer runtime. User may need tsan_flags.h to provide its implementation of __tsan::OverrideFlags
...
llvm-svn: 158708
2012-06-19 08:57:53 +00:00
Alexey Samsonov
af70c09b84
[Sanitizer] State that sanitizer_libc.h header can be included in the user code (and therefore it shouldn't include other sanitizer runtime headers).
...
llvm-svn: 158707
2012-06-19 08:52:02 +00:00
Alexey Samsonov
b13ac747d4
[Sanitizer] use fully qualified type for placement new replacement
...
llvm-svn: 158706
2012-06-19 07:40:45 +00:00
Alexey Samsonov
d9ae7adb84
[TSan] silence -Winternal-linkage-in-inlinewarning which is produced for gtest code
...
llvm-svn: 158705
2012-06-19 07:38:11 +00:00
Joerg Sonnenberger
8524f0ba2f
Declare some variables unsigned to avoid signed vs unsigned mismatches.
...
This exploits the relative order of the arguments and/or checks already
made in the functions.
llvm-svn: 158669
2012-06-18 18:51:13 +00:00
Alexey Samsonov
8516014790
[Sanitizer] add internal_strncmp to sanitizer libc
...
llvm-svn: 158658
2012-06-18 14:34:59 +00:00
Alexey Samsonov
cf7d233ac0
[TSan] kill some linux-specific code in favor of code in common runtime: reuse wrappers for mmap routines, ProcessMaps iterator, thread stack calculation
...
llvm-svn: 158657
2012-06-18 09:42:39 +00:00
Alexey Samsonov
58a3c58ec9
[Sanitizer] move different wrappers from TSan to common sanitizer runtime
...
llvm-svn: 158655
2012-06-18 08:44:30 +00:00
Alexey Samsonov
25c40e5a5b
[Sanitizer] Fix type for placement new on 32-bit Mac
...
llvm-svn: 158524
2012-06-15 14:32:39 +00:00
Alexey Samsonov
0d76e8983f
[Sanitizer] Use ProcessMaps in symbolizer to get module name and offset for instruction address
...
llvm-svn: 158522
2012-06-15 14:00:25 +00:00
Alexey Samsonov
156958dd0c
[Sanitizer] move all the rest re-implementations of libc functions from ASan runtime to common sanitizer runtime
...
llvm-svn: 158519
2012-06-15 13:09:52 +00:00
Alexey Samsonov
3efd6fc26c
[Sanitizer] Use DEFINE_REAL macro in TSan runtime to call libc implementations of functions. Move strchr to sanitizer_libc.
...
llvm-svn: 158517
2012-06-15 12:24:07 +00:00
Bill Wendling
f11b42e396
Free the allocated filename. Found by clang static analyzer.
...
llvm-svn: 158514
2012-06-15 09:12:04 +00:00
Alexey Samsonov
8c4dcd72e3
[Sanitizer] Use mmaped buffer in DumpProcessMaps to avoid large stack frames
...
llvm-svn: 158502
2012-06-15 07:41:23 +00:00
Alexey Samsonov
1042454b66
[TSan] don't use too new __attribute__((unused)) for class member
...
llvm-svn: 158500
2012-06-15 07:33:49 +00:00
Alexey Samsonov
40e5128412
[Sanitizer] move ShadowRangeIsAvailable and several defines to common runtime
...
llvm-svn: 158499
2012-06-15 07:29:14 +00:00
Alexey Samsonov
e4a889866d
[Sanitizer] move atomic ops, min/max and sort to commnon runtime
...
llvm-svn: 158496
2012-06-15 07:00:31 +00:00
Alexey Samsonov
70afb91636
[Sanitizer] move more portability wrappers to common runtime: sleep, _exit, abort, atexit, pthread_self
...
llvm-svn: 158493
2012-06-15 06:37:34 +00:00
Alexey Samsonov
ae1e171b72
[Sanitizer] move DumpProcessMap and DisableCoreDumper to common runtime
...
llvm-svn: 158490
2012-06-15 06:08:19 +00:00
Dmitry Vyukov
ea03fc2d78
tsan: fix COMPAT mapping to not produce false reports
...
llvm-svn: 158473
2012-06-14 21:40:35 +00:00
Alexey Samsonov
c70d1086f6
[Sanitizer] move rest of mmap routines to common sanitizer runtime
...
llvm-svn: 158452
2012-06-14 14:42:58 +00:00
Alexey Samsonov
0c53a38abb
[Sanitizer] move portable GetEnv to common sanitizer runtime
...
llvm-svn: 158451
2012-06-14 14:07:21 +00:00
Alexey Samsonov
96ef49a71e
[Sanitizer] Move internal_memcmp to common sanitizer libc
...
llvm-svn: 158450
2012-06-14 14:04:54 +00:00
Alexey Samsonov
aac5d0c831
[Sanitizer] Workaround for -Wunused-private-field warning - add an attribute in TSan unit test, and silence this warning as gtest has unused fields.
...
llvm-svn: 158449
2012-06-14 14:02:32 +00:00
Alexey Samsonov
52f946611f
[ASan] don't include deleted header
...
llvm-svn: 158448
2012-06-14 13:15:45 +00:00
Alexey Samsonov
53daa28e77
[ASan] remove obsolete header asan_procmaps.h
...
llvm-svn: 158447
2012-06-14 12:51:20 +00:00
Alexander Potapenko
919b4bde28
Add test rdx, rdx to fix ASan tests on Mac OS 10.7 x64
...
llvm-svn: 158312
2012-06-11 15:38:07 +00:00
Alexey Samsonov
bb62f555f3
[Sanitizer] Use __libc_malloc/__libc_free instead of malloc/free inside internal allocator on Linux (important for TSan)
...
llvm-svn: 158261
2012-06-09 09:21:44 +00:00
Alexey Samsonov
f516d39c1f
[TSan] use efficient real_memcpy inside runtime
...
llvm-svn: 158260
2012-06-09 09:14:24 +00:00
Alexey Samsonov
59036d2c06
[Sanitizer] add internal_memset and internal_strrchr to sanitizer_common/
...
llvm-svn: 158202
2012-06-08 14:11:12 +00:00
Alexey Samsonov
99d58521c5
[ASan] allow calls to memmove during rtl initialization
...
llvm-svn: 158201
2012-06-08 14:04:04 +00:00
Alexey Samsonov
6cfc34ea7f
[TSan] s/internal_memset/real_memset
...
llvm-svn: 158200
2012-06-08 13:59:39 +00:00
Alexey Samsonov
f26b842ca8
[ASan] add interceptor for strncat
...
llvm-svn: 158198
2012-06-08 13:27:46 +00:00
Alexey Samsonov
91e1a7eb17
[Sanitizer] move internal_strdup and internal_memcpy to common runtime. Make internal allocations from TSan runtime call InternalAlloc from common runtime
...
llvm-svn: 158148
2012-06-07 11:54:08 +00:00
Alexey Samsonov
8b9aea522f
[Sanitizer] use unsigned int as a parameter for placement new on 32 bits
...
llvm-svn: 158147
2012-06-07 10:09:41 +00:00
Alexey Samsonov
8bd9098b32
[Sanitizer] move placement_new definiton from TSan to common runtime
...
llvm-svn: 158145
2012-06-07 09:50:16 +00:00
Alexey Samsonov
94e2b7d040
[Sanitizer] include stdlib.h header to get malloc/free
...
llvm-svn: 158144
2012-06-07 09:26:13 +00:00
Kostya Serebryany
0b14fd855b
[asan] slow 16-byte redzones (still experimental)
...
llvm-svn: 158143
2012-06-07 09:15:48 +00:00
Alexey Samsonov
3a6ddb86e8
[Sanitizer] Allocator for internal runtime purposes. Currently it calls libcmalloc, but we might have to make it more low-level in future
...
llvm-svn: 158142
2012-06-07 08:52:56 +00:00
Alexey Samsonov
cf4d3a027d
[Sanitizer] Fix mac build.
...
llvm-svn: 158141
2012-06-07 07:32:00 +00:00
Alexey Samsonov
4b1f1031e6
[Sanitizer] factor out GetThreadStackTopAndBottom from ASan runtime to common.
...
llvm-svn: 158140
2012-06-07 07:13:46 +00:00
Alexey Samsonov
28a9895ee0
[Sanitizer] __asan::AsanProcMaps -> __sanitizer::ProcessMaps.
...
llvm-svn: 158139
2012-06-07 06:15:12 +00:00
Alexey Samsonov
fe44fbd750
[Sanitizer] Move ReadFileToBuffer to sanitizer_common.
...
llvm-svn: 158138
2012-06-07 05:38:26 +00:00
Kostya Serebryany
112ac68d52
[asan] more compaction: don't use the next field while the chunk is in allocated state
...
llvm-svn: 158083
2012-06-06 16:58:21 +00:00
Kostya Serebryany
c0bbfbfba2
[asan] more allocator compaction
...
llvm-svn: 158082
2012-06-06 16:33:46 +00:00
Alexey Samsonov
40d5b772e5
[Sanitizer] Switch to common mmap/munmap routines in ASan run-time.
...
llvm-svn: 158078
2012-06-06 16:15:07 +00:00
Alexey Samsonov
e95e29c2ac
[Sanitizer] Make UNIMPLEMENTED macro common.
...
llvm-svn: 158077
2012-06-06 15:47:40 +00:00
Kostya Serebryany
00e22d2b2c
[asan] more compaction for allocator
...
llvm-svn: 158076
2012-06-06 15:30:55 +00:00
Alexey Samsonov
e428779dbf
[Sanitizer] Use common CHECK machinery. Currently each tool has to define its own CheckFailed function.
...
llvm-svn: 158075
2012-06-06 15:22:20 +00:00
Kostya Serebryany
79437fe376
[asan] make tid u32 instead of int
...
llvm-svn: 158074
2012-06-06 15:06:58 +00:00
Kostya Serebryany
53b74ac256
[asan] start compacting the allocator header, the goal is to make it 16 bytes w/o losing any information
...
llvm-svn: 158072
2012-06-06 14:46:38 +00:00
Kostya Serebryany
64166ca86b
[tsan,asan] comment out O_CLOEXEC as it causes build failures on old linux kernels
...
llvm-svn: 158071
2012-06-06 14:11:31 +00:00
Alexey Samsonov
d323f4e78e
[Sanitizer] Remove __attribute__((format))
...
llvm-svn: 158070
2012-06-06 13:58:39 +00:00
Alexey Samsonov
d44cb4cb8a
[ASan] match type of arguments to format string on Mac.
...
llvm-svn: 158068
2012-06-06 13:44:19 +00:00
Alexey Samsonov
8bafdd020e
[Sanitizer] fix Win build - ignore __attribute__((format)).
...
llvm-svn: 158067
2012-06-06 13:37:02 +00:00
Alexey Samsonov
51ae983718
[Sanitizer]: Introduce a common internal printf function. For now, also use tool-specific wrappers TsanPrintf (its output is controlled by TSan flags) and AsanPrintf (which copies its results to the ASan-private buffer). Supported formats: %[z]{d,u,x}, %s, %p. Re-write all format strings in TSan according to this format (this should have no effect on 64-bit platforms).
...
llvm-svn: 158065
2012-06-06 13:11:29 +00:00
Alexey Samsonov
cd96c44dce
[ASan] more format fixes
...
llvm-svn: 158060
2012-06-06 10:54:25 +00:00
Alexey Samsonov
461820ad67
[ASan] Make printf arguments match format strings better.
...
llvm-svn: 158059
2012-06-06 10:46:00 +00:00
Alexey Samsonov
ac4c290d02
[TSan] run some renaming as a preparation for factoring out Printf implementation.
...
llvm-svn: 158058
2012-06-06 10:13:27 +00:00
Alexey Samsonov
201aa367fc
[ASan] fix win build - add missing header
...
llvm-svn: 158057
2012-06-06 09:43:32 +00:00
Alexey Samsonov
ee07290628
[Sanitizer] Move more functions/constants to sanitizer_common.
...
llvm-svn: 158056
2012-06-06 09:26:25 +00:00
Alexey Samsonov
ca2b5d7abb
[Sanitizer] move internal_filesize and internal_dup2 from TSan to sanitizer_common.
...
llvm-svn: 158052
2012-06-06 07:30:33 +00:00
Alexey Samsonov
c4b201308b
[ASan] Use __sanitizer::Die() in ASan runtime.
...
llvm-svn: 158051
2012-06-06 07:02:44 +00:00
Alexey Samsonov
bc3a7e3fe2
[Sanitizer] add sanitizer_common.h for routines shared between TSan and ASan runtimes. Use __sanitizer::Die() in TSan.
...
llvm-svn: 158050
2012-06-06 06:47:26 +00:00
Alexey Samsonov
7fca5ccdae
[ASan] fix GetFreeBytesTest interface test on 32-bit Linux - delete some assumptions about the behavior of allocator in test code
...
llvm-svn: 158047
2012-06-06 06:02:05 +00:00
Alexey Samsonov
5bbf8290a7
[Sanitizer] rename sanitizer_defs.h to sanitizer_internal_defs.h
...
llvm-svn: 158001
2012-06-05 14:25:27 +00:00
Alexey Samsonov
3768b58f82
[Sanitizer] fix compilation on Mac OS 10.6 - don't use O_CLOEXEC
...
llvm-svn: 158000
2012-06-05 14:07:11 +00:00
Alexey Samsonov
8602c65719
[Sanitizer] remove using namespace __sanitizer lines
...
llvm-svn: 157999
2012-06-05 14:05:09 +00:00
Alexey Samsonov
ef2e2cfd33
[Sanitizer] Use common defines for ASan and TSan runtime. Split defines between interface defines (can be visible in user code that includes interface ASan/TSan headers) and internal defines.
...
llvm-svn: 157998
2012-06-05 13:50:57 +00:00
Kostya Serebryany
03cd639b56
[asan] change the order of tests in the asan_test binary. Makes the test runs 2x faster due to DEATH_TEST overhead (see asan issue 77)
...
llvm-svn: 157997
2012-06-05 13:48:15 +00:00
Alexey Samsonov
cc88531760
[TSan] Use internal_munmap from sanitizer_libc in TSan runtime.
...
llvm-svn: 157995
2012-06-05 09:55:24 +00:00
Alexey Samsonov
7ac77d6b29
[Sanitizer] add sanitizer_posix.cc. Move more various functions into sanitizer_libc: sscanf, munmap, memchr
...
llvm-svn: 157994
2012-06-05 09:49:25 +00:00
Alexey Samsonov
9354688dc5
[ASan] s/size_t/uptr in asan_mac.cc
...
llvm-svn: 157993
2012-06-05 09:13:33 +00:00
Alexey Samsonov
b8f35d9512
[TSan] make TSan runtime use internal_{close,read,write} from sanitizer_libc
...
llvm-svn: 157992
2012-06-05 09:00:36 +00:00
Alexey Samsonov
1b12eda7ec
[ASan] use internal_{close,read,write} in ASan runtime.
...
llvm-svn: 157991
2012-06-05 08:48:10 +00:00
Alexey Samsonov
03c8b846c4
[Sanitizer] add internal_{close,read,write} functions to sanitizer_libc
...
llvm-svn: 157990
2012-06-05 08:32:53 +00:00
Alexey Samsonov
298dd7c361
[TSan] use __sanitizer::internal_open in TSan run-time
...
llvm-svn: 157988
2012-06-05 07:46:31 +00:00
Alexey Samsonov
f5e2dc3c3d
[ASan] use internal_open from sanitizer_libc in ASan runtime
...
llvm-svn: 157986
2012-06-05 07:25:47 +00:00
Alexey Samsonov
dde1f11fe6
[Sanitizer] Add sanitizer_win.cc for windows-specific implementations of libc functions. Add internal_open.
...
llvm-svn: 157985
2012-06-05 07:05:10 +00:00
Alexey Samsonov
11fff6df33
[TSan] use __sanitizer::internal_mmap in TSan run-time
...
llvm-svn: 157984
2012-06-05 06:19:00 +00:00
Alexey Samsonov
9ab24cc3f5
[ASan] Fix a typo in Makefile.old
...
llvm-svn: 157982
2012-06-05 05:20:33 +00:00
Alexey Samsonov
b6e4f3690b
[Sanitizer] Enable lint for sanitizer_common/
...
llvm-svn: 157931
2012-06-04 14:35:09 +00:00
Alexey Samsonov
2c5fc3bb11
Created files sanitizer_linux.cc and sanitizer_mac.cc for platform-specific implementations of common functions. Turned asan_mmap into __sanitizer::internal_mmap.
...
llvm-svn: 157930
2012-06-04 14:27:50 +00:00
Alexey Samsonov
3b2f9f4c98
Remove file-type tags in .cc files in tsan/ and sanitizer_common/
...
llvm-svn: 157928
2012-06-04 13:55:19 +00:00
Alexey Samsonov
485d3dc363
Remove file-type tags for .cc files in ASan run-time library
...
llvm-svn: 157927
2012-06-04 13:50:10 +00:00
Alexey Samsonov
90f9630c80
[Sanitizer]: move internal_strcmp to sanitizer_common
...
llvm-svn: 157926
2012-06-04 13:27:49 +00:00
Alexey Samsonov
4ecc8f43c7
[ASan] Use ASan option symbolize to turn on internal symbolizer (in development)
...
llvm-svn: 157924
2012-06-04 11:20:17 +00:00
Alexey Samsonov
06f2cd38c1
[Sanitizer] Move internal_strncpy to sanitizer_libc (and make its behavior conforming to manual)
...
llvm-svn: 157922
2012-06-04 10:30:16 +00:00
Alexey Samsonov
c1971ca12f
[Sanitizer_common] fix filenames in comments
...
llvm-svn: 157919
2012-06-04 09:33:06 +00:00
Alexey Samsonov
cad2e4e6c2
temporary include stdlib.h in symbolizer to fix Mac/Win build
...
llvm-svn: 157808
2012-06-01 07:41:47 +00:00
Kostya Serebryany
02845c1dd4
[asan] fix gcc build
...
llvm-svn: 157807
2012-06-01 07:41:04 +00:00
Alexey Samsonov
6f596767c3
Stub files for common symbolizer for AddressSanitizer and ThreadSanitizer tools.
...
It is an analogue of addr2line utility and should allow to map instruction address to a location
in source code at run-time. It should use debug information (in DWARF) in a binary, and hopefully
it would be possible to re-use code from llvm/DebugInfo/DIContext.h
llvm-svn: 157806
2012-06-01 06:11:13 +00:00
Dmitry Vyukov
95a5c5ca4c
tsan: intercept longjmp() but die in it, greatly simplifies problem diagnostic
...
llvm-svn: 157760
2012-05-31 18:03:59 +00:00
Kostya Serebryany
8a66b71c8f
[asan] partial fix for windows build
...
llvm-svn: 157750
2012-05-31 16:06:05 +00:00
Kostya Serebryany
f8c5a5bcbc
[asan] partial fix for windows build
...
llvm-svn: 157748
2012-05-31 15:44:05 +00:00
Kostya Serebryany
1d35d155fd
[asan] more renaming
...
llvm-svn: 157747
2012-05-31 15:02:07 +00:00
Kostya Serebryany
8d03204204
[asan] more renaming
...
llvm-svn: 157746
2012-05-31 14:35:53 +00:00
Dmitry Vyukov
6f448700e4
tsan: fix a typo
...
llvm-svn: 157744
2012-05-31 14:24:10 +00:00
Kostya Serebryany
1b71207f48
[asan,tsan] introduce sanitizer_common/sanitizer_defs.h and perform some renaming in asan rt. More to come.
...
llvm-svn: 157743
2012-05-31 14:11:07 +00:00
Alexander Potapenko
a39c2fec46
Fix the wildcards for two output tests on Darwin.
...
It turns out that atos does not print the symbol names for static C++ functions correctly (one of the two leading underscores is omitted), so they remain mangled.
llvm-svn: 157742
2012-05-31 13:55:40 +00:00
Kostya Serebryany
c5bea20e2e
[asan,tsan] rename files in sanitizer_common to have a common prefix (sanitizer_).
...
llvm-svn: 157740
2012-05-31 13:42:53 +00:00
Dmitry Vyukov
d6ffccd1da
tsan: suppress reports against source file names as well
...
llvm-svn: 157739
2012-05-31 13:18:11 +00:00
Alexander Potapenko
bb50e7f08c
Be more verbose when installing the signals.
...
llvm-svn: 157693
2012-05-30 15:29:11 +00:00
Alexander Potapenko
6e216bea86
Fix a bug in parsing boolean flags: we used to take the first char of the key=value string
...
instead of the first character of the value.
llvm-svn: 157692
2012-05-30 15:28:45 +00:00
Alexander Potapenko
93b2c7d516
Be less verbose when parsing the default options.
...
llvm-svn: 157691
2012-05-30 14:12:20 +00:00
Dmitry Vyukov
92d917d91c
tsan: prevent recursive signal handlers
...
llvm-svn: 157625
2012-05-29 15:51:27 +00:00
Kostya Serebryany
458b4006b2
[asan,tsan] Add a new directory compiler-rt/lib/sanitizer_common
...
which will contain code shared between asan and tsan run-times.
Naming is hard. If you can suggest a better name for the directory -- speak up.
llvm-svn: 157611
2012-05-29 12:18:18 +00:00
Alexey Samsonov
1cbe656d66
Fixing ASan build on Win: don't use __asan_default_options
...
llvm-svn: 157608
2012-05-29 09:39:01 +00:00
Alexander Potapenko
d07b7b529a
Do not define ___asan_default_options on Windows.
...
llvm-svn: 157603
2012-05-29 08:26:18 +00:00
Dmitry Vyukov
9bf897e696
tsan: fix compiler warnings
...
llvm-svn: 157585
2012-05-28 17:33:08 +00:00
Dmitry Vyukov
880bb6697f
tsan: fix race during pthread_join/detach
...
llvm-svn: 157584
2012-05-28 17:32:50 +00:00
Alexander Potapenko
0efd915d92
Rework the flags machinery a bit.
...
Clients may define the __asan_default_options char string containing the default options for the tool now.
llvm-svn: 157582
2012-05-28 16:21:19 +00:00
Alexander Potapenko
db892de581
More verbose check in AppendString.
...
llvm-svn: 157580
2012-05-28 15:00:45 +00:00
Dmitry Vyukov
e1bbb2f34a
tsan: pass CFLAGS to tests
...
llvm-svn: 157579
2012-05-28 14:15:39 +00:00
Dmitry Vyukov
ed5bc02740
tsan: be more conservative wrt symbolizer output
...
llvm-svn: 157578
2012-05-28 14:14:53 +00:00
Bill Wendling
aa888a29eb
Add support for the GCOV_PREFIX_STRIP env variable which tries to strip off the first 'n' directories from the filename.
...
llvm-svn: 157574
2012-05-28 10:09:01 +00:00
Bill Wendling
65adec933d
Simplify the logic that tries to open the GCDA file at all costs. Basically, if
...
we can't open the file even after creating all of the directories to it, then
just give up.
llvm-svn: 157572
2012-05-28 09:46:43 +00:00
Bill Wendling
bba2a7d46d
* A bit of cleanup of the 'recursive_mkdir'. No functionality change.
...
* Check for absolute paths before using the GCOV_PREFIX.
* Don't add an ending path separator if there's already one.
llvm-svn: 157571
2012-05-28 09:41:48 +00:00
Dmitry Vyukov
d558530754
tsan: increase /proc/self/maps max size (1M is far not enough)
...
llvm-svn: 157570
2012-05-28 09:24:01 +00:00
Dmitry Vyukov
bd310f02a5
asan/tsan: rename interceptors from __xsan_xxx to __interceptor_xxx
...
llvm-svn: 157569
2012-05-28 07:47:35 +00:00
Dmitry Vyukov
ebdf670ae7
tsan: more robust detection of stack of main thread
...
llvm-svn: 157568
2012-05-28 07:46:42 +00:00
Dmitry Vyukov
3de9ca068f
tsan: use DCHECK_GT/LT instead of plain DCHECK (better diagnostics)
...
llvm-svn: 157567
2012-05-28 07:45:35 +00:00
Dmitry Vyukov
2d4e3c140f
tsan: do not clean stack/tls for main thread
...
llvm-svn: 157566
2012-05-28 07:44:34 +00:00
Dmitry Vyukov
9b13e9f3b5
asan: remove static libraries on make clean
...
llvm-svn: 157565
2012-05-28 07:43:36 +00:00
Bill Wendling
f16084723c
Don't use 'strrchr', which isn't implemented here yet.
...
llvm-svn: 157560
2012-05-28 02:50:53 +00:00
Bill Wendling
74f987f3b6
Sync with old GCOV runtime library's file.
...
llvm-svn: 157559
2012-05-28 02:34:34 +00:00
Alexander Potapenko
4e424b85e3
Typo fix.
...
llvm-svn: 157477
2012-05-25 15:56:40 +00:00
Alexander Potapenko
85e93ef612
Factor ParseAsanOptions outside __asan_init
...
llvm-svn: 157473
2012-05-25 15:37:16 +00:00
Alexander Potapenko
442002568c
Introduce the check_malloc_usable_size flag (on by default).
...
When the flag is set to zero, we do not check for errors in malloc_usable_size.
This may be useful to work around a bug in Nvidia drivers prior to 295.*
llvm-svn: 157472
2012-05-25 15:20:13 +00:00
Dmitry Vyukov
7339eb197b
tsan: do not call into libc in symbolizer and in other code (this causes recursion and crashes)
...
llvm-svn: 157466
2012-05-25 11:15:04 +00:00
Dmitry Vyukov
e86497ee1c
tsan: output message about failure to intercept only if verbosity flag is passed
...
llvm-svn: 157465
2012-05-25 09:47:18 +00:00
Dmitry Vyukov
ff25cf5887
asan: fix tests
...
depending on -m32/-m64 addr2line says either e.g. __xsan_strnlen or just strnlen
llvm-svn: 157464
2012-05-25 09:46:33 +00:00
Meador Inge
6fef6e6466
Adding back a right parenthesis that was dropped in r157388.
...
llvm-svn: 157406
2012-05-24 18:16:39 +00:00
Dmitry Vyukov
d1b9521e48
tsan: compilation of tests with newest clang
...
llvm-svn: 157392
2012-05-24 14:55:12 +00:00
Dmitry Vyukov
30c32a8819
tsan: fix compilation with newest clang
...
llvm-svn: 157391
2012-05-24 14:50:33 +00:00
Dmitry Vyukov
7fb7330469
asan/tsan: weak interceptors
...
The idea isthat asan/tsan can survive if user intercepts the same functions. At the same time user has an ability to call back into asan/tsan runtime. See the following tests for examples:
asan/output_tests/interception_failure_test-linux.cc
asan/output_tests/interception_test-linux.cc
asan/output_tests/interception_malloc_test-linux.cc
llvm-svn: 157388
2012-05-24 13:54:31 +00:00
Dmitry Vyukov
65c21a5e6d
tsan: add a flag to control RunningOnValgrind() return value
...
llvm-svn: 157383
2012-05-24 09:24:45 +00:00