Commit Graph

778 Commits

Author SHA1 Message Date
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
Daniel Dunbar 8137cecb68 build/clang_darwin: More principled fix for PR12918; none of this stuff should
be built here.

llvm-svn: 159172
2012-06-25 22:41:31 +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
Chandler Carruth 84ba680c83 Disable the test subdirectory entirely until we get fresh CMake files
there. I didn't notice this because I had a stub that wasn't checked in
floating around in my client.

llvm-svn: 159025
2012-06-22 20:17:27 +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