Alexey Samsonov
cfe56d47da
[Sanitizer] Minor enhancements in InternalVector container
...
llvm-svn: 178238
2013-03-28 15:37:11 +00:00
Kostya Serebryany
3e73c84050
[tsan] a test checking that memset/memcpy/memmove are not inlined in tsan mode
...
llvm-svn: 178231
2013-03-28 11:21:50 +00:00
Alexey Samsonov
e586170e86
Fix unmatching ASan runtime flag for init-order checking exposed by r178158. Add a test for r178158.
...
llvm-svn: 178229
2013-03-28 09:11:20 +00:00
Kostya Serebryany
ac83282665
[tsan] don't use -fno-builtin for tests; add a test for a false negative bug (inlined memcpy is not instrumented)
...
llvm-svn: 178228
2013-03-28 08:41:49 +00:00
Richard Smith
74e3d39710
compiler-rt part of r178194. Remove ubsan test for diagnostic on inf/nan conversion between floating-point types.
...
llvm-svn: 178195
2013-03-27 23:21:10 +00:00
Dmitry Vyukov
b365d40415
tsan: print matched suppressions if print_suppressions=1 flag is provided
...
llvm-svn: 178159
2013-03-27 17:59:57 +00:00
Dmitry Vyukov
fd3f5ec0cb
tsan: better flag parsing: do not confuse flag that is a part of another flag
...
(e.g. suppressions and print_suppressions)
llvm-svn: 178158
2013-03-27 17:59:13 +00:00
Dmitry Vyukov
9f08fe5065
tsan: fix lint warning
...
llvm-svn: 178157
2013-03-27 17:57:58 +00:00
Alexey Samsonov
7152debedd
[ASan] Demangle global names in error reports.
...
llvm-svn: 178131
2013-03-27 10:41:22 +00:00
Alexey Samsonov
f903a9ee6e
[TSan] Fixup for r178128: verify that TSan indeed doesn't report race
...
llvm-svn: 178129
2013-03-27 10:22:51 +00:00
Alexey Samsonov
059e61f8b0
[TSan] Run test output through FileCheck
...
llvm-svn: 178128
2013-03-27 09:25:06 +00:00
Alexey Samsonov
56a784d2f6
[ASan] Change the ABI of __asan_before_dynamic_init function: now it takes pointer to private string with module name. This string serves as a unique module ID in ASan runtime. compiler-rt part
...
llvm-svn: 178014
2013-03-26 13:06:12 +00:00
Alexander Potapenko
29310ba077
[libsanitizer] Fix the Win build.
...
llvm-svn: 178012
2013-03-26 13:02:11 +00:00
Kostya Serebryany
79a6e189b0
[tsan] make memcpy_race.cc test immune to memcpy inlining
...
llvm-svn: 178011
2013-03-26 12:42:18 +00:00
Dmitry Vyukov
6f4b34bcf4
asan/tsan: move strcasecmp() interceptor to sanitizer_common
...
llvm-svn: 178010
2013-03-26 12:40:23 +00:00
Dmitry Vyukov
f3bc56bb6b
asan/tsan: change SANITIZER_GO to more general SANITIZER_SUPPORTS_WEAK_HOOKS
...
llvm-svn: 178009
2013-03-26 12:07:04 +00:00
Alexander Potapenko
f8109dd0f8
[libsanitizer] Unmapping the old cache partially invalidates the memory layout, so add
...
a flag to skip cache update for cases when that's unacceptable (e.g. lsan).
Patch by Sergey Matveev (earthdok@google.com )
llvm-svn: 178000
2013-03-26 10:34:37 +00:00
Alexey Samsonov
7ef76c1cd8
[Sanitizer] Disable atomic_test on Android, where it crashes Clang.
...
llvm-svn: 177998
2013-03-26 08:55:38 +00:00
Kostya Serebryany
4d7efba66e
[tsan] add a test for aligned-vs-unaligned race (tsan's false negative)
...
llvm-svn: 177996
2013-03-26 08:31:02 +00:00
Kostya Serebryany
88b2b45ec8
[asan] print thread number while reporting invalid-free and double-free; add tests; also add a test for use-after-poison
...
llvm-svn: 177993
2013-03-26 08:01:37 +00:00
Timur Iskhodzhanov
2dee3dd61c
Add a GetTid() implementation for Windows
...
llvm-svn: 177927
2013-03-25 22:04:29 +00:00
Alexey Samsonov
6210e1f9ff
Add basic support for building profile compiler-rt library in CMake build on Darwin
...
llvm-svn: 177870
2013-03-25 14:20:11 +00:00
Alexey Samsonov
961b636cf1
[ASan] Use dynamic symbol table when checking exported ASan runtime symbols
...
llvm-svn: 177868
2013-03-25 13:47:53 +00:00
Dmitry Vyukov
7886253fee
asan/tsan: add Printf/Report hook
...
The hook can be overriden in frontend to print to e.g. a file.
llvm-svn: 177864
2013-03-25 12:58:09 +00:00
Alexey Samsonov
9328ba400a
[ASan] mark local function as static
...
llvm-svn: 177862
2013-03-25 11:38:42 +00:00
Alexey Samsonov
acfb82e611
[Sanitizer] Compile sanitizer runtimes with -Wno-non-virtual-dtor. Virtual dtors may be a problem for us, as sanitizer runtime should not generally assume libstdc++ presence.
...
llvm-svn: 177860
2013-03-25 10:31:49 +00:00
Alexey Samsonov
31a2c483ed
[TSan] Build TSan unit tests with the same compile flags as TSan runtime
...
llvm-svn: 177859
2013-03-25 10:23:20 +00:00
Dmitry Vyukov
4adf49d253
tsan: intercept setjmp/longjmp
...
llvm-svn: 177858
2013-03-25 10:10:44 +00:00
Dmitry Vyukov
510ad11800
tsan: add SetEnv() function that can be used in frontends
...
llvm-svn: 177857
2013-03-25 09:56:45 +00:00
Alexey Samsonov
a208c397bf
[Sanitizer] First effort to implement atomic_compare_exchange for 1-byte vars on Windows
...
llvm-svn: 177854
2013-03-25 09:23:30 +00:00
Alexey Samsonov
c6fd019c77
[Sanitizer] Add basic test for atomic_compare_exchange implementation
...
llvm-svn: 177851
2013-03-25 08:48:16 +00:00
Richard Smith
c91e327cba
Build and install .syms files alongside sanitizer runtimes. These are used to
...
specify which symbols are exported to DSOs when the sanitizer is statically
linked into a binary.
llvm-svn: 177784
2013-03-23 00:31:07 +00:00
Timur Iskhodzhanov
fb74020cea
Revert 177745 as it was incorrect
...
llvm-svn: 177746
2013-03-22 18:16:57 +00:00
Timur Iskhodzhanov
e117eef77f
Band-aid fix for the Windows build caused by r177710. Long-term, atomic_compare_exchange_strong should be a template on Windows too...
...
llvm-svn: 177745
2013-03-22 18:05:28 +00:00
Dmitry Vyukov
9af68719ed
tsan: return 0 on malloc() failure instead of crashing
...
llvm-svn: 177741
2013-03-22 17:06:22 +00:00
Evgeniy Stepanov
ecbf64648f
[msan] Handle dlopen() failure in dlopen interceptor.
...
llvm-svn: 177728
2013-03-22 11:59:49 +00:00
Dmitry Vyukov
3bd5ffb62b
tsan: test that tsan explicitly says "race on vptr".
...
Requires llvm r177717.
llvm-svn: 177726
2013-03-22 10:54:39 +00:00
Kostya Serebryany
667a34a120
[asan] Change the way we report the alloca frame on stack-buff-overflow.
...
Before: the function name was stored by the compiler as a constant string
and the run-time was printing it.
Now: the PC is stored instead and the run-time prints the full symbolized frame.
This adds a couple of instructions into every function with non-empty stack frame,
but also reduces the binary size because we store less strings (I saw 2% size reduction).
This change bumps the asan ABI version to v3.
compiler-rt part, llvm part will follow.
Example of report (now):
==31711==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffa77cf1c5 at pc 0x41feb0 bp 0x7fffa77cefb0 sp 0x7fffa77cefa8
READ of size 1 at 0x7fffa77cf1c5 thread T0
#0 0x41feaf in Frame0(int, char*, char*, char*) stack-oob-frames.cc:20
#1 0x41f7ff in Frame1(int, char*, char*) stack-oob-frames.cc:24
#2 0x41f477 in Frame2(int, char*) stack-oob-frames.cc:28
#3 0x41f194 in Frame3(int) stack-oob-frames.cc:32
#4 0x41eee0 in main stack-oob-frames.cc:38
#5 0x7f0c5566f76c (/lib/x86_64-linux-gnu/libc.so.6+0x2176c)
#6 0x41eb1c (/usr/local/google/kcc/llvm_cmake/a.out+0x41eb1c)
Address 0x7fffa77cf1c5 is located in stack of thread T0 at offset 293 in frame
#0 0x41f87f in Frame0(int, char*, char*, char*) stack-oob-frames.cc:12 <<<<<<<<<<<<<< this is new
This frame has 6 object(s):
[32, 36) 'frame.addr'
[96, 104) 'a.addr'
[160, 168) 'b.addr'
[224, 232) 'c.addr'
[288, 292) 's'
[352, 360) 'd'
llvm-svn: 177723
2013-03-22 10:36:24 +00:00
Evgeniy Stepanov
93a842bd1f
[msan] Move test main and gtest include to separate files.
...
llvm-svn: 177718
2013-03-22 09:01:26 +00:00
Evgeniy Stepanov
bfe9df221d
[msan] Place dlopen in an anon namespace.
...
llvm-svn: 177716
2013-03-22 08:49:36 +00:00
Dmitry Vyukov
2f411641fe
tsan: work around FileCheck bug with empty outputs
...
llvm-svn: 177715
2013-03-22 08:48:34 +00:00
Evgeniy Stepanov
5d69168906
[msan] Get rid of "using std::string" in msandr.
...
llvm-svn: 177714
2013-03-22 08:47:42 +00:00
Alexey Samsonov
f1311dfce1
[ASan] fix-up for r177634 on Windows.
...
llvm-svn: 177711
2013-03-22 07:48:23 +00:00
Alexey Samsonov
a5eb3cb721
[ASan] Fix an error on invalid deallocation in ASan allocator. When ASan checks if memory freed by user was indeed previously allocated, it first does an atomic write to presumed location of chunk header. This is wrong, as if the free is invalid, we may overwrite some valuable data (like other fields of the chunk header). Fix this by using atomic_compare_exchange instead.
...
llvm-svn: 177710
2013-03-22 07:40:34 +00:00
Dmitry Vyukov
a7e42b5be5
asan: fix lint warning about line length
...
llvm-svn: 177709
2013-03-22 07:29:59 +00:00
Richard Smith
b30d11194c
ubsan: Pass floating-point arguments to the runtime by value if they fit the
...
value argument.
llvm-svn: 177689
2013-03-22 00:47:05 +00:00
Richard Smith
1ea5b805ce
Don't forget to link in the C++-specific parts of the ubsan runtime when using the Makefile build system on Darwin.
...
llvm-svn: 177684
2013-03-22 00:01:44 +00:00
Dmitry Vyukov
ebf63d0095
tsan: better reporting of thread leaks
...
1. do not report running threads as leaks
2. aggregate leaked threads by creation stack
llvm-svn: 177647
2013-03-21 16:55:17 +00:00
Dmitry Vyukov
0851fa8819
tsan: better reporting for races on vptr
...
explicitly say "ctor/dtor vs virtual call"
llvm-svn: 177640
2013-03-21 15:37:39 +00:00
Dmitry Vyukov
2c3b919ad3
tsan: add flag to control symbolizer flush frequency
...
llvm-svn: 177638
2013-03-21 13:01:50 +00:00
Dmitry Vyukov
69c323d66f
tsan: intercept abort() to fflush() libc streams
...
llvm-svn: 177637
2013-03-21 12:50:43 +00:00
Dmitry Vyukov
6911a7f1d1
tsan: remove bogus CHECK
...
Asynchronous signal (e.g. SIGABRT) can be received with any value of in_rtl.
llvm-svn: 177636
2013-03-21 12:44:44 +00:00
Alexey Samsonov
54afba8b62
[ASan] Switch ASan to generic ThreadRegistry from sanitizer_common. Delete ASan-specific AsanThreadRegistry.
...
llvm-svn: 177634
2013-03-21 11:23:41 +00:00
Dmitry Vyukov
48e5d4a2d3
tsan: flush symbolizer cache if not symbolized for more than 5 seconds
...
llvm-svn: 177629
2013-03-21 07:02:36 +00:00
Dmitry Vyukov
5e797a8e57
tsan: add a comment about magic numbers
...
llvm-svn: 177628
2013-03-21 06:28:04 +00:00
Dmitry Vyukov
78693730a4
tsan: use a single background thread for memory profiler and memory flush (and later for symbolizer flush)
...
llvm-svn: 177627
2013-03-21 06:24:31 +00:00
Richard Smith
b6f3905450
Per discussion on cxx-abi-dev, switch from comparing type_info objects to
...
comparing type_info names, since the latter have better uniqueness guarantees
in practice.
llvm-svn: 177618
2013-03-21 00:42:03 +00:00
Richard Smith
e86b7b0bb9
Split ubsan runtime into three pieces (compiler-rt part):
...
* libclang_rt-san-* is sanitizer_common, and is linked in only if no other
sanitizer runtime is present.
* libclang_rt-ubsan-* is the piece of the runtime which doesn't depend on
a C++ ABI library, and is always linked in.
* libclang_rt-ubsan_cxx-* is the piece of the runtime which depends on a
C++ ABI library, and is only linked in when linking a C++ binary.
The Darwin ubsan runtime is unchanged.
For more details, see Clang change r177605.
llvm-svn: 177606
2013-03-20 23:49:17 +00:00
Bill Wendling
7184d34f96
Add declaration for linux.
...
llvm-svn: 177601
2013-03-20 23:21:08 +00:00
Bill Wendling
51a6ff5799
Create a coverage initialization function.
...
This function replaces the call of `atexit' from being generated in the compile
units. Basically, it registers the "writeout" and "flush" functions (if
present). It will generate calls to the `atexit' function for cleanups and final
writeout functions, but only once. This is better than checking for `main',
because a library may not have a `main' function in it.
<rdar://problem/12439551>
llvm-svn: 177578
2013-03-20 21:11:47 +00:00
Dmitry Vyukov
6120bac6e6
tsan: correct sizes of signal-related data structures
...
llvm-svn: 177526
2013-03-20 14:57:28 +00:00
Dmitry Vyukov
9f94dff7a6
tsan: add missing stat descriptions
...
llvm-svn: 177523
2013-03-20 14:04:23 +00:00
Dmitry Vyukov
0954e9c01d
tsan: call fflush(0) on exit again
...
llvm-svn: 177522
2013-03-20 14:01:10 +00:00
Dmitry Vyukov
c638a7127e
tsan: reduce size of mutexsets from 64 to 16 mutexes
...
overflow is handled anyway
saves memory because each thread holds 1024 mutexsets
llvm-svn: 177520
2013-03-20 13:50:47 +00:00
Dmitry Vyukov
3330200d92
tsan: fix incorrect test
...
llvm-svn: 177519
2013-03-20 13:49:45 +00:00
Dmitry Vyukov
b62c158d81
tsan: special handling of .rodata (don't try to find races, don't keep shadow, dont' put into traces)
...
llvm-svn: 177517
2013-03-20 13:21:50 +00:00
Dmitry Vyukov
ccbdea956f
tsan: fix build
...
llvm-svn: 177513
2013-03-20 11:22:03 +00:00
Dmitry Vyukov
79915de6af
tsan: move trace header into 0x600000000000 range
...
eliminat thread "dead info" altogether
llvm-svn: 177512
2013-03-20 10:31:53 +00:00
Dmitry Vyukov
b6eace8a2f
tsan: add internal_unlink() function
...
llvm-svn: 177510
2013-03-20 10:28:36 +00:00
Alexey Samsonov
920b3b9a0c
[ASan] Move malloc stats collection away from AsanThreadRegistry class.
...
llvm-svn: 177508
2013-03-20 10:11:24 +00:00
Dmitry Vyukov
31056968fc
asan/tsan: reduce per-thread memory allocator caches
...
256 blocks (which is 512 in reallity) seems to be too big cache,
reducing the size reduces memory consumption but does not degrade performance.
llvm-svn: 177502
2013-03-20 09:26:46 +00:00
Alexey Samsonov
cf025cb2e6
[ASan] Move GetCurrentThread/SetCurrentThread from AsanThreadRegistry class into plain functions: they don't actually use registry
...
llvm-svn: 177501
2013-03-20 09:23:28 +00:00
Dmitry Vyukov
b7c68ee856
tsan: fix flaky test
...
llvm-svn: 177500
2013-03-20 09:22:13 +00:00
Dmitry Vyukov
f6c4a7a2f5
tsan: fix incorrect test
...
llvm-svn: 177499
2013-03-20 09:21:49 +00:00
Evgeniy Stepanov
52b2d13245
[sanitizer] Enable prctl interceptor on Android.
...
llvm-svn: 177497
2013-03-20 07:35:52 +00:00
Bill Wendling
e647659d58
Add a way to register and execute "writeout" functions.
...
It may be prohibitively expensive to write out >1000 files at the same time. So
we would rather emit them serially. These functions allow the GCOV
implementation to register the functions that writeout the GCOV information per
compile unit. At exit, they are written.
<rdar://problem/12439551>
llvm-svn: 177436
2013-03-19 21:01:19 +00:00
Evgeniy Stepanov
9a8f0f55d5
[asan] s/ASAN_POSIX/SANITIZER_POSIX/
...
llvm-svn: 177407
2013-03-19 15:26:41 +00:00
Evgeniy Stepanov
95eaa21637
[sanitizer] More renamed macros.
...
llvm-svn: 177401
2013-03-19 14:54:17 +00:00
Evgeniy Stepanov
0af672326a
[sanitizer] Replace more platform checks with SANITIZER_ constants.
...
llvm-svn: 177400
2013-03-19 14:33:38 +00:00
Evgeniy Stepanov
d3b56605f1
[sanitizer] Move ASan platform macros to sanitizer_common and rename them appropriately.
...
llvm-svn: 177397
2013-03-19 13:54:41 +00:00
Alexey Samsonov
45d2f96582
Don't use --sysroot to linux SDK when building libprofile - SDK on Linux seems to be incomplete.
...
llvm-svn: 177396
2013-03-19 13:34:23 +00:00
Dmitry Vyukov
082afc8346
tsan: fix build
...
llvm-svn: 177395
2013-03-19 13:34:12 +00:00
Dmitry Vyukov
4ecfa696e0
tsan: flush dead thread info earlier (when another thread is finished rather than new thread is created)
...
llvm-svn: 177394
2013-03-19 12:25:48 +00:00
Dmitry Vyukov
9dd06ad47a
tsan: instruct malloc() to consume less memory
...
llvm-svn: 177393
2013-03-19 12:24:19 +00:00
Dmitry Vyukov
f3fde82667
tsan: symbolizer "flush caches" support
...
llvm-svn: 177389
2013-03-19 10:24:01 +00:00
Dmitry Vyukov
29f335ae80
tsan: symbolizer "flush caches" functinality
...
llvm-svn: 177388
2013-03-19 10:23:17 +00:00
Dmitry Vyukov
509dab30ae
tsan: fix memory leak
...
llvm-svn: 177387
2013-03-19 10:22:33 +00:00
Evgeniy Stepanov
6d02c1c598
[sanitizer] Avoid use of uintptr_t.
...
llvm-svn: 177384
2013-03-19 09:39:15 +00:00
Evgeniy Stepanov
b4a218db34
[sanitizer] Don't adjust the size of the user-allocated stack.
...
Moved this code to sanitizer_common.
llvm-svn: 177383
2013-03-19 09:30:52 +00:00
Alexey Samsonov
4c17c1b157
Support CMake build of profile runtime library on Linux
...
llvm-svn: 177382
2013-03-19 09:17:35 +00:00
Dmitry Vyukov
b59fa875ad
tsan: do not allocate sync vars on relaxed atomic operations
...
helps to reduce memory consumption if an atomic is used only with relaxed ops (stats)
llvm-svn: 177381
2013-03-19 09:15:31 +00:00
Richard Smith
807e4dced5
Update ubsan test for clang change r177362.
...
llvm-svn: 177363
2013-03-19 00:04:20 +00:00
Bill Wendling
2428f167f7
Add some GCOV functions that register all of the __llvm_gcov_flush() functions.
...
The __llvm_gcov_flush() functions only work for the local compile unit. However,
when __gcov_flush() is called, the user expects all of the counters to be
flushed, not just the ones in the current compile unit.
This adds some library functions that register the flush functions. It also
defined __gcov_flush() so that loops through that list and calls the functions.
PR15191 & <rdar://problem/13167507>
llvm-svn: 177337
2013-03-18 22:59:47 +00:00
Dmitry Vyukov
4ddd37ba5b
tsan: smaller memory block headers (32b->16b)
...
llvm-svn: 177312
2013-03-18 19:47:36 +00:00
Dmitry Vyukov
61ce9560d4
tsan: add support for idle threads
...
llvm-svn: 177292
2013-03-18 17:21:15 +00:00
Dmitry Vyukov
ce26a0aa92
tsan: touch less shadow memory during operations on big memory ranges
...
greatly reduces memory consumption
llvm-svn: 177289
2013-03-18 16:56:48 +00:00
Dmitry Vyukov
2e7f29f042
tsan: mark shadow for thread stack as "don't need" when thread exits
...
llvm-svn: 177288
2013-03-18 15:49:07 +00:00
Dmitry Vyukov
f123337275
tsan: better memory profiler
...
llvm-svn: 177286
2013-03-18 13:55:33 +00:00
Dmitry Vyukov
15bee188c4
tsan: madvise(DONTNEED) shadow memory on munmap()
...
llvm-svn: 177278
2013-03-18 11:51:51 +00:00
Kostya Serebryany
9138f75d0a
[asan] make the __asan_get_heap_size more robust
...
llvm-svn: 177270
2013-03-18 10:52:25 +00:00
Dmitry Vyukov
20bf8c7778
tsan: move implementation out of h file
...
llvm-svn: 177269
2013-03-18 10:32:21 +00:00
Dmitry Vyukov
49e462fab2
tsan: fix clang -Wall build
...
Clang does not like classes with virtual functions but w/o virtual dtor.
Go does not like libstdc++ (operator delete).
llvm-svn: 177267
2013-03-18 10:10:15 +00:00
Alexey Samsonov
b5d10f69e4
[TSan] re-apply r177249 lost in edits
...
llvm-svn: 177265
2013-03-18 09:45:22 +00:00
Evgeniy Stepanov
6488b2b257
[asan] Switch to allocator2 on Android.
...
llvm-svn: 177263
2013-03-18 09:22:58 +00:00
Dmitry Vyukov
a1bdd2d942
tsan: fix memory leak
...
llvm-svn: 177262
2013-03-18 09:09:41 +00:00
Dmitry Vyukov
7cd2025c4d
tsan: use StackDepot for thread creation stacks
...
llvm-svn: 177261
2013-03-18 09:02:27 +00:00
Dmitry Vyukov
50160030e1
tsan: fix Go build
...
llvm-svn: 177260
2013-03-18 08:52:46 +00:00
Dmitry Vyukov
a221620b2e
tsan: use StackDepot in sync object to store creation stacks
...
llvm-svn: 177258
2013-03-18 08:27:47 +00:00
Dmitry Vyukov
6f7ca81cce
tsan: fix huge stack frames
...
llvm-svn: 177255
2013-03-18 08:09:42 +00:00
Kostya Serebryany
c4722a65a5
[asan] while generating the description of a global variable, emit the module name in a separate field, thus not duplicating this information if every description. This decreases the binary size (observed up to 3%). https://code.google.com/p/address-sanitizer/issues/detail?id=168 . This changes the asan API version. compiler-rt part, llvm-part will follow
...
llvm-svn: 177253
2013-03-18 08:04:55 +00:00
Dmitry Vyukov
0f2c7ea5d0
tsan: fix lint warnings
...
llvm-svn: 177251
2013-03-18 07:58:20 +00:00
Alexey Samsonov
cbed82ea70
[TSan] fix undefined variable in debug TSan build
...
llvm-svn: 177249
2013-03-18 07:33:00 +00:00
Alexey Samsonov
4f1c8a13d5
[TSan] Use ThreadRegistry::FindThreadContextLocked() to find thread by its stack/tls address.
...
llvm-svn: 177248
2013-03-18 07:02:08 +00:00
Alexey Samsonov
e1955b851d
[TSan] Makefiles: allow configurable paths to clang and FileCheck. Add -fno-rtti flag.
...
llvm-svn: 177247
2013-03-18 07:00:36 +00:00
Alexey Samsonov
f9dbbda5bc
[Sanitizer] Get rid of global mutexes in StopTheWorld implementation
...
llvm-svn: 177246
2013-03-18 06:27:13 +00:00
Alexey Samsonov
e25c72958a
[Sanitizer] Rely on template argument deduction in sanitizer_allocator_test
...
llvm-svn: 177245
2013-03-18 06:07:44 +00:00
Alexander Potapenko
845b575370
[libsanitizer] StopTheWorld in sanitizer_common
...
StopTheWorld puts the process in a suspended state before running the
user-supplied callback. To be used in TSan and in leak checking code.
Linux implementation provided.
Patch by Sergey Matveev (earthdok@google.com )
llvm-svn: 177156
2013-03-15 14:37:21 +00:00
Alexey Samsonov
3a6b6b9d55
[Sanitizer] Don't intercept frexpf and frexpl on Windows. Add frexp declaration to asan_intercepted_functions.h
...
llvm-svn: 177155
2013-03-15 14:02:21 +00:00
Alexey Samsonov
9aecdfe34d
[TSan] Switch TSan runtime to use ThreadRegistry class from sanitizer_common
...
llvm-svn: 177154
2013-03-15 13:48:44 +00:00
Alexey Samsonov
e4385c4b98
[Sanitizer] Don't link tests with -lpthread on Android.
...
llvm-svn: 177151
2013-03-15 12:54:01 +00:00
Kostya Serebryany
96a7620f3a
[sanitizer] fix gcc build warnings
...
llvm-svn: 177149
2013-03-15 12:27:52 +00:00
Kostya Serebryany
b941a2fca4
[asan] Add ForEachChunk() to sanitizer allocators. Patch by Sergey Matveev
...
llvm-svn: 177147
2013-03-15 11:39:41 +00:00
Alexey Samsonov
cdd46d9ccc
[Sanitizer] Generalize compile/link flags for sanitizer_common tests on Android and on other platforms.
...
llvm-svn: 177146
2013-03-15 10:39:26 +00:00
Alexey Samsonov
337b0fcf9c
[Sanitizer] Build sanitizer_common tests w/o RTTI. Move ThreadRegistry class members below methods.
...
llvm-svn: 177143
2013-03-15 07:08:52 +00:00
Eric Christopher
d3c993b396
Fix a virtual destructor warning.
...
Patch by Manuel Klimek!
llvm-svn: 177132
2013-03-15 00:20:17 +00:00
Alexey Samsonov
d1999a1ccc
[Sanitizer] Fix compiler warnings and style issues in sanitizer_common tests. Use -Werror=sign-compare when building them.
...
llvm-svn: 177077
2013-03-14 15:15:35 +00:00
Alexey Samsonov
1cb684381a
[Sanitizer] Add generic ThreadRegistry class for sanitizer runtimes. This class holds basic thread bookkeeping logic and allows specific sanitizer runtimes to create thread contexts and mark threads as created/running/joined etc. The class is based on the way we currently store thread contexts in TSan.
...
llvm-svn: 177074
2013-03-14 13:54:30 +00:00
Alexey Samsonov
a097f7b1e3
[Sanitizer] Add default constructor for BlockingMutex
...
llvm-svn: 177072
2013-03-14 13:30:56 +00:00
Evgeniy Stepanov
8d487b4407
[sanitizer] No dirent64 on Android.
...
llvm-svn: 177071
2013-03-14 13:24:03 +00:00
Alexey Samsonov
3d09fdbf21
[Sanitizer] Build sanitizer_common with -fno-rtti
...
llvm-svn: 177070
2013-03-14 13:16:35 +00:00
Kostya Serebryany
d332d42372
[asan] remove one redundant malloc stress test, unify the usage of ASAN_LOW_MEMORY macro in tests, slightly reduce test memory usage (all to make 32-bit runs consume less RAM)
...
llvm-svn: 177069
2013-03-14 13:16:09 +00:00
Alexander Potapenko
34e1171768
[libsanitizer] fixed a bug in ThreadLister tests where we forgot to terminate one thread
...
Patch by Sergey Matveev (earthdok@google.com )
llvm-svn: 177068
2013-03-14 13:15:14 +00:00
Evgeniy Stepanov
740e6ebe71
[msan] Add changes missing from r177065.
...
llvm-svn: 177067
2013-03-14 13:13:49 +00:00
Evgeniy Stepanov
c6bce93591
[msan] Intercept readdir64.
...
llvm-svn: 177065
2013-03-14 12:49:23 +00:00
Alexey Samsonov
1dc928e1b1
[ASan] remove -fsanitize=init-order from lit tests as now it's implied by -fsanitize=address
...
llvm-svn: 177064
2013-03-14 12:43:03 +00:00
Alexander Potapenko
ac3bbb3ef3
[libsanitizer] Fixed incorrect handling of pre-existing threads in ThreadLister test.
...
Also, extended the test to check that ThreadLister::Reset() works as intended.
Patch by Sergey Matveev (earthdok@google.com )
llvm-svn: 177060
2013-03-14 12:06:54 +00:00
Evgeniy Stepanov
4062a396c7
[msan] Fix a typo in test.
...
llvm-svn: 177059
2013-03-14 11:58:13 +00:00
Alexey Samsonov
963be1ddd8
[ASan] turn off checking initialization order in ASan runtime by default. Instead, it should be turned on by default in the compiler
...
llvm-svn: 177058
2013-03-14 11:49:40 +00:00
Evgeniy Stepanov
fe0199ea54
[msan] Options for switching between fast and cfi unwinders in run time.
...
Does not change default behavior.
llvm-svn: 177057
2013-03-14 11:47:03 +00:00
Evgeniy Stepanov
231894a902
[sanitizer] Intercept frexp and friends.
...
llvm-svn: 177056
2013-03-14 11:34:39 +00:00
Alexey Samsonov
7d2385419a
[Sanitizer] fix compilation for Windows
...
llvm-svn: 177054
2013-03-14 11:29:06 +00:00
Evgeniy Stepanov
ead6cf7c72
[msan] Intercept __strdup, strndup, __strndup.
...
llvm-svn: 177052
2013-03-14 11:10:36 +00:00
Alexey Samsonov
83e7622df6
[Sanitizer] Write a slightly better implementation of GetEnv() function on Windows
...
llvm-svn: 177051
2013-03-14 11:10:23 +00:00
Alexey Samsonov
140cd84155
[ASan] make ASan assume ASAN_OPTIONS=symbolize=1 if ASAN_EXTERNAL_SYMBOLIZER is defined
...
llvm-svn: 177036
2013-03-14 10:07:40 +00:00
Alexey Samsonov
41a560b8cd
[TSan] Add missing header inclusion
...
llvm-svn: 177013
2013-03-14 07:13:00 +00:00
Alexey Samsonov
109ddd0fe4
[TSan] Use __sanitizer_pthread_attr_t in TSan
...
llvm-svn: 177012
2013-03-14 07:10:52 +00:00
Reid Kleckner
2325273641
[msan] Clean up extensions during msandr shutdown
...
Otherwise debug DynamoRIO complains at us for leaking memory.
llvm-svn: 176947
2013-03-13 13:59:09 +00:00
Evgeniy Stepanov
96f82f8ac3
[sanitizer] Fix lint.
...
llvm-svn: 176943
2013-03-13 10:20:35 +00:00
Alexey Samsonov
d7ab381f53
[Sanitizer] Build ASan, TSan and MSan runtimes with -fno-rtti.
...
llvm-svn: 176940
2013-03-13 09:18:30 +00:00
Evgeniy Stepanov
98f5ea0dba
[msan] Increase stack size as required.
...
Adjust stack size in pthread_attr_t when the app-requested size does not fit MSan TLS.
llvm-svn: 176939
2013-03-13 09:01:40 +00:00
Evgeniy Stepanov
5697b58ec4
[sanitizer] Move GetTlsSize code from TSan to sanitizer_common.
...
llvm-svn: 176938
2013-03-13 08:19:53 +00:00
Evgeniy Stepanov
24aad9c0cb
Break a >80 char line.
...
llvm-svn: 176937
2013-03-13 08:17:39 +00:00
Alexey Samsonov
91f833a413
[Sanitizer] Fixup for r176931 for Mac and Windows
...
llvm-svn: 176935
2013-03-13 07:39:25 +00:00
Alexey Samsonov
d38aceda4e
[Sanitizer] Fix a typo in function name
...
llvm-svn: 176932
2013-03-13 06:55:02 +00:00
Alexey Samsonov
06d3aa4884
[Sanitizer] Change MemoryMappingLayout methods to also report memory protection flags (for future use in leak checker). Patch by Sergey Matveev.
...
llvm-svn: 176931
2013-03-13 06:51:02 +00:00
Kostya Serebryany
67b1478914
[asan] use 4Tb of address space for the asan allocator instead of 1Tb. This increases the memory available for a single size class from 16Gb to 64Gb. The total VM footprint becomes 20Tb
...
llvm-svn: 176857
2013-03-12 09:04:49 +00:00
Kostya Serebryany
138b155042
[sanitizer] use fewer size classes in the allocator to reduce the memory footprint. There is no all-size-fits-all constant here, but this change is positive or neutral on several large apps I've tested
...
llvm-svn: 176855
2013-03-12 08:44:40 +00:00
Evgeniy Stepanov
26d5bc7fdf
[msan] Use sptr instead of ptrdiff_t.
...
llvm-svn: 176854
2013-03-12 07:21:17 +00:00
Kostya Serebryany
ba56c8d4f9
[sanitizer] simplify the allocator's SizeClassMap: do not require an extra template parameter, instead compute it in flight. No functionality change
...
llvm-svn: 176853
2013-03-12 07:01:27 +00:00
Reid Kleckner
c9d382b5a4
[msan] intercept dlopen and clear shadow for it
...
Summary:
The loader does not call mmap() through the PLT because it has to
bootstrap the process before libc is present. Hooking dlopen() isn't
enough either because the loader runs module initializers before
returning, and they could run arbitrary msan instrumented code.
If msandr is present, then we can intercept the mmaps from dlopen at the
syscall layer and clear the shadow there. If msandr is missing, we
clear the shadow after dlopen() and hope any initializers are trivial.
Reviewers: eugenis
CC: kcc, llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D509
llvm-svn: 176818
2013-03-11 18:07:42 +00:00
Alexey Samsonov
db7d9656bb
[Sanitizer] Implement BlockingMutex::CheckLocked()
...
llvm-svn: 176805
2013-03-11 15:45:20 +00:00
Alexander Potapenko
1f78ad5da4
[ASan] Reduce the local buffer size in Report() not to fail the check enforced when building TSan runtime.
...
llvm-svn: 176804
2013-03-11 13:36:39 +00:00
Alexander Potapenko
18c916c6c5
[ASan] Try to use a small (512 bytes) stack-local buffer in Report() for short messages, fall back to MmapOrDie() in the case of a failure.
...
This shall eliminate most of the cryptic "ERROR: failed to mmap" messages caused by recursively calling MmapOrDie() from MmapOrDie().
llvm-svn: 176802
2013-03-11 11:47:43 +00:00
Alexander Potapenko
92cc1a6d24
[ASan] don't call strerr from functions that map memory, since this results in malloc().
...
llvm-svn: 176800
2013-03-11 10:21:28 +00:00
Kostya Serebryany
0f5c20b417
[sanitizer] make SizeClassAllocator64::GetBlockBegin more bullet proof (by Sergey Matveev)
...
llvm-svn: 176799
2013-03-11 09:43:12 +00:00
Nick Lewycky
593eeb000a
Don't emit the extra checksum into the .gcda file if the user hasn't asked for
...
it. Fortunately, versions of gcov that predate the extra checksum also ignore
any extra data, so this isn't a problem. This matches the API change made in
r176745.
llvm-svn: 176746
2013-03-09 01:33:12 +00:00
Nick Lewycky
8015c6ee2f
Take the GCDA version string as an input to llvm_gcda_start_file.
...
llvm-svn: 176618
2013-03-07 08:28:54 +00:00
Reid Kleckner
063dfe3244
[msan] Block reports from interceptors during _Unwind_Backtrace
...
Summary:
I'm hitting a big recursive report from:
uninit on strlen ->
__msan::PrintWarningWithOrigin() ->
__msan::GetStackTrace() ->
__sanitizer::StackTrace::SlowUnwindStack() ->
_Unwind_Backtrace() ->
... libgcc calls ->
uninit on strlen() ->
... repeats
Reviewers: eugenis
Differential Revision: http://llvm-reviews.chandlerc.com/D497
llvm-svn: 176555
2013-03-06 16:11:58 +00:00
Reid Kleckner
c193da57b8
[msan] pthread_join() returns int, not void*
...
pthread_join() returns an error code, not the result of the
pthread_create() function like I thought.
llvm-svn: 176554
2013-03-06 15:41:35 +00:00
Reid Kleckner
66c26e5e96
[sanitizers] Fix check failure on dealloc from new thread
...
Summary:
Adds a test for this case, which was reduced from a chromium build of
WebKit's DumpRenderTree.
Reviewers: eugenis
CC: glider
Differential Revision: http://llvm-reviews.chandlerc.com/D495
llvm-svn: 176552
2013-03-06 14:54:08 +00:00
Alexey Samsonov
dcb0e72e6f
[Sanitizer] fix signed-unsigned mismatch in test and use correct order of EXPECT_EQ() args
...
llvm-svn: 176479
2013-03-05 12:23:07 +00:00
Alexey Samsonov
434dde9996
[Sanitizer] Add methods back() and pop_back() to InternalVector. Patch by Sergey Matveev
...
llvm-svn: 176478
2013-03-05 11:58:25 +00:00
Nick Kledzik
2b9a65e4c4
update how libcompiler_rt.dylib links under libSystem.dylib on MacOSX
...
llvm-svn: 176466
2013-03-05 00:16:52 +00:00
Evgeniy Stepanov
f5d8c90f57
[asan] Revert r176255, r176264.
...
New allocator has 1.5x memory overhead of the old one.
llvm-svn: 176340
2013-03-01 09:33:05 +00:00
Evgeniy Stepanov
323771b3f1
[sanitizer] Fix check failure in SizeClassMap::Print.
...
llvm-svn: 176338
2013-03-01 08:49:14 +00:00
Evgeniy Stepanov
3305b177e6
[asan] Lower memory usage in LargeMallocTest on Android.
...
llvm-svn: 176264
2013-02-28 15:54:58 +00:00
Alexander Potapenko
f1c48eb509
[ASan] Add the memcmp_strict flag (1 by default) that controls the behavior of accessibility checks in memcmp.
...
1: memcmp(p1, p2, n) always checks n bytes
0: memcmp checks up to n bytes depending on whether the memory contents differ.
llvm-svn: 176256
2013-02-28 14:09:30 +00:00
Evgeniy Stepanov
1cb95a17b8
[asan] Enable allocator2 on Android.
...
llvm-svn: 176255
2013-02-28 14:07:01 +00:00
Kostya Serebryany
abebb57272
[asan] bump kMidMemEnd to 0x4fffffffffULL since in rare cases prelink uses addresses higher than 0x3fffffffff
...
llvm-svn: 176250
2013-02-28 12:28:37 +00:00
Alexey Samsonov
4a3234bec5
[Sanitizer] Relax ThreadLister tests to allow possible pre-existing threads. Do proper mutex destruction. Patch by Sergey Matveev
...
llvm-svn: 176249
2013-02-28 11:33:51 +00:00
Evgeniy Stepanov
218c582cb5
[msan] Lit tests for __attribute__((no_sanitize_memory)).
...
llvm-svn: 176248
2013-02-28 11:25:54 +00:00
Nick Lewycky
1052c99f46
Holy macaroons, somebody made a copy of llvm/runtime/profile/GCDAProfiling.c,
...
didn't delete the original, and now they've diverged. I have no idea what's
going on. Apply my patch in r176173 to this one too, this one looks newer?
llvm-svn: 176236
2013-02-28 07:00:13 +00:00
Kostya Serebryany
8ee2a5adc7
[asan] if calloc returns a freshly-mmaped memory, don't clear it with memset. Speeds up calloc-intensive code
...
llvm-svn: 176185
2013-02-27 13:38:19 +00:00
Alexey Samsonov
49b86b354a
[Sanitizer] don't include missing header on Android
...
llvm-svn: 176183
2013-02-27 13:03:35 +00:00
Alexey Samsonov
46a36d5019
[UBSan] Use common report decorator to print colorful diagnostics in UBSan, and be more consistent w/ Printf/RawWrite
...
llvm-svn: 176182
2013-02-27 12:58:24 +00:00
Kostya Serebryany
f0b8f989e9
add Linux syscall wrappers and ThreadLister to sanitizer_common
...
ThreadLister is a Linux-specific class for obtaining the thread IDs of a process from procfs (/proc/<pid>/task/). It will be used by leak checking code.
Also add several syscall wrappers which will be required by the same code that uses ThreadLister, but are not used in ThreadLister itself.
Patch by Sergey Matveev
llvm-svn: 176179
2013-02-27 11:22:40 +00:00
Kostya Serebryany
c98cddd024
[asan] guard ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS definition with an #ifndef
...
llvm-svn: 176175
2013-02-27 08:28:24 +00:00
Alexey Samsonov
086b940b1e
[Sanitizer] Don't die if external symbolizer is used on Mac, where it's not implemented yet
...
llvm-svn: 176091
2013-02-26 13:40:51 +00:00
Kostya Serebryany
a8cfb900dd
[sanitizer] A low-level vector implementation to be used in leak checking code. Patch by Sergey Matveev
...
llvm-svn: 176089
2013-02-26 13:30:27 +00:00
Kostya Serebryany
459df6f167
[asan] a bit stricter lint for CHECK vs CHECK_XX (these CHECK_XX really help debugging!)
...
llvm-svn: 176085
2013-02-26 12:59:06 +00:00
Kostya Serebryany
01a32bdef1
[tsan] enable tsan-vs-gvn test since it is now fixed
...
llvm-svn: 176079
2013-02-26 08:18:27 +00:00
Kostya Serebryany
8caf654731
[asan] fix the output for range accesses (memset, etc); improve the tests; more strict checking in memcmp
...
llvm-svn: 176078
2013-02-26 07:25:18 +00:00
Kostya Serebryany
c8ac15a66b
[asan] use the new attribute syntax (no_address_safety_analysis => no_sanitize_address)
...
llvm-svn: 176077
2013-02-26 07:01:06 +00:00
Alexey Samsonov
54ff0f6388
[Sanitizer] one more fix for signed/unsigned mismatch in comparison
...
llvm-svn: 176020
2013-02-25 14:06:38 +00:00
Alexey Samsonov
b2ac280f96
[Sanitizer] fix signed/unsigned compare warnings in sanitizer_stacktrace_test. Build sanitizer_common tests with -Werror as we use predictable just-built Clang for building them
...
llvm-svn: 176014
2013-02-25 09:00:03 +00:00
Alexey Samsonov
85f0a7e644
[TSan] Add interceptor for malloc_usable_size()
...
llvm-svn: 176013
2013-02-25 08:43:10 +00:00
Alexey Samsonov
10bccda948
[TSan] remove temporary build directory in 'make clean' command
...
llvm-svn: 176012
2013-02-25 08:32:02 +00:00
Richard Smith
0404ec8396
ubsan: Runtime handlers for array indexing checks.
...
llvm-svn: 175948
2013-02-23 02:40:07 +00:00
Reid Kleckner
e1596856ec
[Sanitizer] Add a test for the fast unwinder
...
Summary:
The test sets up fake x86-style fp+retaddr frames, since that's all the
unwinder works with.
Reviewers: kcc
CC: eugenis
Differential Revision: http://llvm-reviews.chandlerc.com/D445
llvm-svn: 175893
2013-02-22 15:10:16 +00:00
Evgeniy Stepanov
3065014026
[msan] MSanDR: initial commit.
...
MSanDR is a DynamoRio-based tool that handles uninstrumented libraries and
dynamically generated code for MSan.
llvm-svn: 175883
2013-02-22 09:34:19 +00:00
Kostya Serebryany
1d63d13ce2
[asan] move the .preinit_array hack into a separate file (added used attribute)
...
llvm-svn: 175871
2013-02-22 07:51:26 +00:00
Alexander Potapenko
97781c4dd0
[ASan] temporarily disable alloc_dealloc_mismatch on Mac, since the previous commit caused error reports in gTest.
...
llvm-svn: 175766
2013-02-21 17:12:21 +00:00
Alexander Potapenko
a47c6ee286
[ASan] Make sure operator new/delete and friends are intercepted on OS X.
...
Because the interceptors will reside in a dylib, not the main executable, we can't just declare them,
but must use the interposition machinery.
Fix the test expectations in large_func_test.cc affected by the change.
This CL should make our Mac buildbots green.
llvm-svn: 175763
2013-02-21 16:54:09 +00:00
Alexander Potapenko
1615f193eb
[ASan] Declare CreateThread as extern "C" to fix the Windows build.
...
llvm-svn: 175760
2013-02-21 15:32:50 +00:00
Alexander Potapenko
8dbcb98c52
[ASan] Revert the incorrect macro on Linux.
...
llvm-svn: 175745
2013-02-21 15:15:43 +00:00
Alexander Potapenko
b8135a8a6b
[ASan] Put several function prototypes back under #ifdef _WIN32 to fix the Windows build.
...
llvm-svn: 175743
2013-02-21 15:10:03 +00:00
Alexander Potapenko
e8ba1c851a
[ASan] Refactoring: nuke the redundant function declarations in asan_intercepted_functions.h
...
that had been used on OS X only.
The INTERCEPTOR() macro on OS X is now responsible for declaring the wrapped function, the wrapper and the
pair of pointers to them in __DATA,__interposition section. Thus adding an interceptor requires editing a single file now.
llvm-svn: 175740
2013-02-21 14:41:16 +00:00
Evgeniy Stepanov
57d6f737e6
[sanitizer] Add MSan to Makefile-based build rules.
...
llvm-svn: 175737
2013-02-21 13:55:54 +00:00
Kostya Serebryany
ab5be26af5
[asan] speedup by more than 2x handling of the small memset/memcpy/etc calls
...
llvm-svn: 175728
2013-02-21 07:07:39 +00:00
Reid Kleckner
15f2d1f4be
[Sanitizer] Try to fix infinite loop in frame pointer unwinder
...
Using > instead of >= ensures that each frame deref makes progress and
that we eventually terminate.
Issue: https://code.google.com/p/address-sanitizer/issues/detail?id=162
llvm-svn: 175661
2013-02-20 20:29:48 +00:00
Alexey Samsonov
7dc2b2f07d
[ASan] revert part of r175631 that looks like accidental commit
...
llvm-svn: 175655
2013-02-20 19:55:47 +00:00
Alexander Potapenko
70b01558f1
[ASan] Delete asan/dynamic dir and temporarily move the interposers declarations to asan_intercepted_functions.h
...
Now that we have only one dependency on asan_intercepted_functions.h, we can unite that code with the interceptors declarations in asan_interceptors.cc and get rid of asan_intercepted_functions.h
llvm-svn: 175631
2013-02-20 15:46:02 +00:00
Alexander Potapenko
56821acc79
[ASan] Make isoc99_*scanf intercepted on Linux only. Those are unavailable on Darwin.
...
llvm-svn: 175629
2013-02-20 15:27:58 +00:00
Kostya Serebryany
7b989859a8
[asan] move preinit_test to Linux since on Mac __asan_init is called from ld-preload-ed runtime
...
llvm-svn: 175625
2013-02-20 15:10:22 +00:00
Kostya Serebryany
d8c29210e5
[asan] on linux, run __asan_init from .preinit_array (even earlier than before)
...
llvm-svn: 175623
2013-02-20 14:28:08 +00:00
Alexey Samsonov
aadd1f2ad6
[Sanitizer] use raw syscall instead of _exit() function on Linux
...
llvm-svn: 175622
2013-02-20 13:54:32 +00:00
Kostya Serebryany
ac05bc0556
[asan] add a lit test for invoke-with-no-return instrumentation
...
llvm-svn: 175618
2013-02-20 12:37:22 +00:00
Evgeniy Stepanov
ec1d286111
[sanitizer] Fix lint.
...
llvm-svn: 175615
2013-02-20 11:06:07 +00:00
Kostya Serebryany
8381ef2035
[asan] add test throw_call_test (broken with -static-libstdc++)
...
llvm-svn: 175614
2013-02-20 10:43:05 +00:00
Evgeniy Stepanov
2e50efd484
[sanitizer] Fix FileOps test on Android.
...
llvm-svn: 175515
2013-02-19 15:01:05 +00:00
Kostya Serebryany
96401c9da9
[asan] don't run the long double test if long double is the same as double
...
llvm-svn: 175514
2013-02-19 13:43:44 +00:00
Evgeniy Stepanov
477e88ee9e
[sanitizer] Slightly lower allocator test memory consumption.
...
This way it fits on a random 1G device.
llvm-svn: 175513
2013-02-19 13:38:27 +00:00
Alexey Samsonov
0b07c63e07
[ASan] Allow ASan default runtime options be overriden at compile time by providing ASAN_DEFAULT_OPTIONS macro
...
llvm-svn: 175512
2013-02-19 13:14:48 +00:00
Alexey Samsonov
99b81b4bbe
[Sanitizer] Allow runtime flags be separated by colon as well as space
...
llvm-svn: 175511
2013-02-19 13:03:37 +00:00
Evgeniy Stepanov
76dc3a81ea
[msan] Use slow stack unwinder in UMR reports.
...
llvm-svn: 175510
2013-02-19 12:43:18 +00:00
Kostya Serebryany
9f298da9bd
[asan] instrument memory accesses with unusual sizes
...
This patch makes asan instrument memory accesses with unusual sizes (e.g. 5 bytes or 10 bytes), e.g. long double or
packed structures.
Instrumentation is done with two 1-byte checks
(first and last bytes) and if the error is found
__asan_report_load_n(addr, real_size) or
__asan_report_store_n(addr, real_size)
is called.
asan-rt part
Also fix lint.
llvm-svn: 175508
2013-02-19 11:30:25 +00:00
Evgeniy Stepanov
adaca58526
[msan] Fix ReExec on linux.
...
execle(argv[0], ...) is wrong, because argv[0] may contain a PATH-resolvable
program name. Execute /proc/self/exe instead.
llvm-svn: 175504
2013-02-19 11:09:29 +00:00
Evgeniy Stepanov
3e2e32c618
[sanitizer] Fix Android build.
...
llvm-svn: 175503
2013-02-19 11:06:41 +00:00
Evgeniy Stepanov
ea61d08185
[sanitizer] Add interceptors for localtime and friends.
...
llvm-svn: 175499
2013-02-19 09:19:16 +00:00
Kostya Serebryany
3e62fe8c23
[tsan] use our own GetEnv instead of libc's getenv
...
llvm-svn: 175498
2013-02-19 08:19:13 +00:00
Kostya Serebryany
776f3bba96
[asan] enable asan_prelink_test when gold is the default linker (gold and bfd linker have different flag syntax)
...
llvm-svn: 175431
2013-02-18 08:37:49 +00:00
Kostya Serebryany
15e9c852c0
[asan] added flag -d|--demangle to asan_symbolize.py, makes addr2line/llvm-symbolizer demangle the functions names
...
llvm-svn: 175429
2013-02-18 08:02:16 +00:00
Alexey Samsonov
9211bd33ec
[Sanitizer] Make temporary filename depend on user ID
...
llvm-svn: 175424
2013-02-18 07:17:12 +00:00
Alexey Samsonov
4544d1fa3d
[ASan] make variables unsigned to silence warnings - attempt 2
...
llvm-svn: 175285
2013-02-15 19:22:49 +00:00
Alexey Samsonov
f6d7379def
[ASan] make variable unsigned to silence the warning
...
llvm-svn: 175284
2013-02-15 19:02:32 +00:00
Alexander Potapenko
3182c3e441
[ASan] Fix https://code.google.com/p/address-sanitizer/issues/detail?id=159
...
MaybeReexec() does now a tricky job to manage DYLD_INSERT_LIBRARIES in a safe way.
Because we're using library interposition, it's critical for an instrumented app
to be executed with the runtime library present in DYLD_INSERT_LIBRARIES list.
Therefore if it's initially missing in that list, we append the runtime library name
to the value of DYLD_INSERT_LIBRARIES and then exec() ourselves.
On the other hand, some of the apps exec()ed by our program may not want to have
ASan runtime library preloaded, so we remove the runtime library from the
DYLD_INSERT_LIBRARIES if it's already there.
Users may want to preload other libraries using DYLD_INSERT_LIBRARIES, so we preserve those.
llvm-svn: 175276
2013-02-15 16:10:49 +00:00
Kostya Serebryany
fd61b6f0c8
[asan] make asan work with 7fff8000 offset and prelink
...
When prelink is installed in the system, prelink-ed
libraries map between 0x003000000000 and 0x004000000000 thus occupying the shadow Gap,
so we need so split the address space even further, like this:
|| [0x10007fff8000, 0x7fffffffffff] || HighMem ||
|| [0x02008fff7000, 0x10007fff7fff] || HighShadow ||
|| [0x004000000000, 0x02008fff6fff] || ShadowGap3 ||
|| [0x003000000000, 0x003fffffffff] || MidMem ||
|| [0x00087fff8000, 0x002fffffffff] || ShadowGap2 ||
|| [0x00067fff8000, 0x00087fff7fff] || MidShadow ||
|| [0x00008fff7000, 0x00067fff7fff] || ShadowGap ||
|| [0x00007fff8000, 0x00008fff6fff] || LowShadow ||
|| [0x000000000000, 0x00007fff7fff] || LowMem ||
Do it only if necessary.
Also added a bit of profiling code to make sure that the
mapping code is efficient.
Added a lit test to simulate prelink-ed libraries.
Unfortunately, this test does not work with binutils-gold linker.
If gold is the default linker the test silently passes.
Also replaced
__has_feature(address_sanitizer)
with
__has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
in two places.
Patch partially by Jakub Jelinek.
llvm-svn: 175263
2013-02-15 12:00:24 +00:00
Evgeniy Stepanov
2a25bfe06a
[sanitizer] Get full argv and envp on glibc.
...
/proc/$PID/cmdline is clipped to 4Kb.
Locate argv and envp on the main thread stack.
llvm-svn: 175163
2013-02-14 14:40:03 +00:00
Alexander Potapenko
594d99588b
[ASan] Fixed the wrong placement of #include
...
llvm-svn: 175157
2013-02-14 12:37:17 +00:00
Alexander Potapenko
6ad3589964
[ASan] Remove the 'alarm' script which isn't present on OS X by default.
...
The test may hang now if a regression occurs.
llvm-svn: 175155
2013-02-14 12:18:07 +00:00
Dmitry Vyukov
965a10e07c
tsan: fix bug in suppression reading (suppressions from file were discarded)
...
llvm-svn: 175153
2013-02-14 11:03:45 +00:00
Evgeniy Stepanov
763b2981b4
[sanitizer] Raise argv limit for ReExec.
...
We are still limited by /proc/*/cmdline size (4Kb max on Linux!).
llvm-svn: 175145
2013-02-14 08:22:06 +00:00
Kostya Serebryany
dd0ab08b6e
[asan] use short path for sanitizer_common/tests/sanitizer_test_utils.h, add -I sanitizer_common/tests to asan/tests/CMakeLists.txt
...
llvm-svn: 175142
2013-02-14 08:12:26 +00:00
Kostya Serebryany
039fa75e4d
[asan] fix x32 build (H.J. Lu)
...
llvm-svn: 175140
2013-02-14 08:05:55 +00:00
Kostya Serebryany
aa7f2b5aa6
[tsan] disable a failing test until it gets fixed. fix lint
...
llvm-svn: 175137
2013-02-14 06:54:51 +00:00
Richard Smith
6d9f13127c
ubsan: Add checking for invalid downcasts. Per [expr.static.cast]p2 and p11,
...
base-to-derived casts have undefined behavior if the object is not actually an
instance of the derived type. Runtime library part.
llvm-svn: 175079
2013-02-13 21:18:23 +00:00
Alexander Potapenko
c5ba5ef3c5
[ASan] When re-executing the process on OS X, make sure we update the existing DYLD_INSERT_LIBRARIES correctly.
...
Previously ASan used to hang in an exec loop, because it failed to overwrite the env var value
(see https://code.google.com/p/address-sanitizer/issues/detail?id=159 ).
llvm-svn: 175059
2013-02-13 17:52:55 +00:00
Dmitry Vyukov
3c2489e2c3
tsan: do not imitate memory write on malloc() (Go)
...
better memory range access functions (put only 1 event to trace) (Go)
llvm-svn: 175056
2013-02-13 13:05:36 +00:00
Kostya Serebryany
32214a2587
[asan] fix fixed mapping for mac (ASAN_FLEXIBLE_MAPPING_AND_OFFSET=0)
...
llvm-svn: 175049
2013-02-13 10:15:03 +00:00
Kostya Serebryany
ec87e785a3
[msan] don't check shadow inside interceptors if we are inside symbolizer; add weak function __msan_default_options that overrides default options
...
llvm-svn: 175040
2013-02-13 07:19:47 +00:00