Commit Graph

748 Commits

Author SHA1 Message Date
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