Commit Graph

3975 Commits

Author SHA1 Message Date
Alexey Samsonov d94e87db3f [Sanitizer] Add rudimentary support for wide-character strings to scanf/printf interceptors
llvm-svn: 207443
2014-04-28 20:40:25 +00:00
Kostya Serebryany cacbac7ba9 [asan] fix a test
llvm-svn: 207417
2014-04-28 13:18:59 +00:00
Kostya Serebryany 4f9c31a2fa [asan] split detect_odr_violation into two: =2 detects all ODR violations, =1 detects only those where the variable sizes are different. BTW, the detector seems to be working well and finding nice bugs. Early adopters are welcome.
llvm-svn: 207415
2014-04-28 12:47:58 +00:00
Viktor Kutuzov f9eba2f51d Fix building Asan and common sanitizers tests on FreeBSD 9.2
llvm-svn: 207408
2014-04-28 10:33:01 +00:00
Evgeniy Stepanov c435fb07dd [sanitizer] Limit fopen interceptor to linux.
llvm-svn: 207227
2014-04-25 13:55:29 +00:00
Evgeniy Stepanov f3d5d119a8 [sanitizer] Intercept a bunch of stdio calls.
Add move fopen/freopen interceptors from TSan to common.

llvm-svn: 207224
2014-04-25 13:26:21 +00:00
Alexander Potapenko 623c989eea [ASan] Use a non-null altstack.ss_size when disabling sigaltstack on Darwin.
llvm-svn: 207220
2014-04-25 10:39:41 +00:00
Dmitry Vyukov edae43b0a9 tsan: allow to suppress all reports
Fixes issue https://code.google.com/p/thread-sanitizer/issues/detail?id=45

llvm-svn: 207218
2014-04-25 10:09:18 +00:00
Dmitry Vyukov 0d0107d2ef tsan: better reports for "unlock of an unlocked mutex"
llvm-svn: 207211
2014-04-25 09:01:17 +00:00
Kostya Serebryany e91930a7e6 [asan] implement an experimental detector of ODR violations. Not tested yet outside of a tiny test, may need tuning.
llvm-svn: 207210
2014-04-25 08:58:28 +00:00
Dmitry Vyukov 56a18f02ea tsan: better reports for "read lock of a write locked mutex"
llvm-svn: 207209
2014-04-25 08:58:23 +00:00
Dmitry Vyukov e296164f77 tsan: improve "read unlock of a write locked mutex" report
llvm-svn: 207208
2014-04-25 08:21:30 +00:00
Dmitry Vyukov 66dbbbc47b tsan: fix tests
failure:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-centos-6.5/builds/3747/steps/test/logs/stdio

llvm-svn: 207207
2014-04-25 08:13:45 +00:00
Dmitry Vyukov 2c87108a42 tsan: better report for bad mutex unlocks
+ fixes crashes due to races on symbolizer, see
https://code.google.com/p/thread-sanitizer/issues/detail?id=55

llvm-svn: 207206
2014-04-25 07:55:11 +00:00
Dmitry Vyukov ea014b787a tsan: add new test for commit 207204 (forget to add new file)
llvm-svn: 207205
2014-04-25 07:49:36 +00:00
Dmitry Vyukov c845decce1 tsan: better reports for "double lock of a mutex"
+ fixes crashes due to races on symbolizer, see:
https://code.google.com/p/thread-sanitizer/issues/detail?id=55

llvm-svn: 207204
2014-04-25 07:42:55 +00:00
Justin Bogner b83dd55eb6 [sanitizer] wordexp isn't available on iOS
llvm-svn: 207140
2014-04-24 20:10:31 +00:00
Peter Collingbourne 16f2f18105 Add user-defined callback on write() calls.
Add dfsan_set_write_callback(), which sets a callback to be invoked when
a write() call is invoked within DFSan instrumented code.

Patch by Sam Kerner!

Differential Revision: http://reviews.llvm.org/D3268

llvm-svn: 207131
2014-04-24 17:42:16 +00:00
Dmitry Vyukov b7ebc53772 tsan: stop background thread when sandbox is enabled
Fixes https://code.google.com/p/thread-sanitizer/issues/detail?id=56

llvm-svn: 207114
2014-04-24 13:09:17 +00:00
Timur Iskhodzhanov 34ad1a1085 Add DLL thunks for recently-added memcpy, memset and memmove ASan intrinsics
llvm-svn: 207113
2014-04-24 12:58:26 +00:00
Kostya Serebryany 7afc6b2c72 [asan] enable use_sigaltstack by default (this will provide verbose reports on stack-overflow instead of silently crashing with SEGV)
llvm-svn: 207099
2014-04-24 11:55:17 +00:00
Alexander Potapenko a51e483846 [ASan] Move the shadow range on 32-bit iOS (and iOS Simulator)
to 0x40000000-0x60000000 to avoid address space clash with system libraries.
The solution has been proposed by tahabekireren@gmail.com in https://code.google.com/p/address-sanitizer/issues/detail?id=210
This is also known to fix some Chromium iOS tests.

llvm-svn: 207002
2014-04-23 17:14:45 +00:00
Evgeniy Stepanov 5a7c364343 [msan] Disable chained origins in signal handlers.
StackDepot is not async-signal-safe; storing a new origin to it can deadlock.

llvm-svn: 206983
2014-04-23 14:01:57 +00:00
Dmitry Vyukov ac81ee5533 tsan: fix atexit handling after fork
fixes issue http://code.google.com/p/thread-sanitizer/issues/detail?id=57

llvm-svn: 206980
2014-04-23 13:42:16 +00:00
Kostya Serebryany 8cd3d27879 [asan] disable lsan back. :( -- It appears that quite a few lit tests have leaks and they were not covered by out buildbot
llvm-svn: 206955
2014-04-23 08:15:16 +00:00
Dmitry Vyukov b1edac069e tsan: more precise check for "app memory" in COMPAT mode
this fires when a user makes mmap with fixed address (see the test)

llvm-svn: 206952
2014-04-23 07:01:02 +00:00
Dmitry Vyukov ae5c1070ba tsan: reduce number of iterations in the test
otherwise it runs for 50 seconds in debug mode

llvm-svn: 206950
2014-04-23 06:49:09 +00:00
Alexey Samsonov 01be4280be [profile] Flatten profile runtime - define platform-specific code in sources, not in the build system
llvm-svn: 206915
2014-04-22 18:49:32 +00:00
Kostya Serebryany c9db838267 [asan] enable LeakSanitizer (LSan) by default in asan. This only affects Linux x86_64. LSan has been used in various projects for more than half a year and we now consider it quite stable to be on by default.
llvm-svn: 206896
2014-04-22 13:56:56 +00:00
Alexander Potapenko 6e647c13e4 [ASan] Fixed the expectation for Darwin memset test.
Added a comment about keeping the Linux/Darwin test versions in sync.

llvm-svn: 206881
2014-04-22 10:53:57 +00:00
Kostya Serebryany 26c4e96455 [sanitizer] enable check_printf by default for asan and tsan. We've been using this flag for a while and it seems to be stable enough for the rest of the world.
llvm-svn: 206872
2014-04-22 09:17:08 +00:00
Evgeniy Stepanov a7f9071f25 [sanitizer] Intercept tsearch.
llvm-svn: 206755
2014-04-21 14:21:51 +00:00
Dmitry Vyukov 5e52f3a142 tsan: deflake test
ocasionally it fails with a slightly different report:

WARNING: ThreadSanitizer: signal handler spoils errno (pid=3674)
    #0 MyHandler(int, siginfo*, void*)
    ...
    #4 __tsan_free_hook
    #5 main signal_errno.cc:40
llvm-svn: 206754
2014-04-21 14:21:24 +00:00
Kostya Serebryany 38bb53b2c5 [asan] add a run-time flag detect_container_overflow=true/false
llvm-svn: 206753
2014-04-21 14:18:45 +00:00
Kostya Serebryany 632751539e [asan] add __asan_memset and friends
llvm-svn: 206748
2014-04-21 11:58:25 +00:00
Kostya Serebryany 74f8d65ae4 [asan] add one more mode to run asan tests with '-with-calls', i.e. using -mllvm -asan-instrumentation-with-call-threshold=0. This is very unfortunate since it effectively doubles the number of gunit asan tests that need to be built and run, but as long as we need out-lined calls (PR17409) I see no other way to test this workaround
llvm-svn: 206742
2014-04-21 10:31:35 +00:00
Kostya Serebryany 3d2629c514 [asan] implement __asan_loadN/__asan_storeN for out-lined asan checks
llvm-svn: 206733
2014-04-21 07:09:01 +00:00
Evgeniy Stepanov 561c4db707 [asan] Reenable tests that should pass since PR19207 is fixed.
llvm-svn: 206593
2014-04-18 13:24:03 +00:00
Evgeniy Stepanov 474011d55d [msan] Add missing quotes.
llvm-svn: 206589
2014-04-18 13:03:54 +00:00
Evgeniy Stepanov 191ebd874f [msan] Run msan_test in the new with-calls mode.
llvm-svn: 206587
2014-04-18 12:19:28 +00:00
Evgeniy Stepanov 83477cb93b [msan] Missing declarations for the new interface functions.
llvm-svn: 206586
2014-04-18 12:18:00 +00:00
Evgeniy Stepanov 8f41674719 [msan] Add new MSan callbacks for instrumentation-with-calls mode.
llvm-svn: 206584
2014-04-18 12:15:24 +00:00
Dmitry Vyukov 10d4b14a16 tsan: add benchmark that allows to investigate shadow memory consumption
llvm-svn: 206578
2014-04-18 10:37:39 +00:00
Alexander Potapenko da1c510ea6 [ASan] Change AddressSanitizer.LoadStoreCallbacks to use asan_malloc and asan_free.
Interceptors don't really work on OSX in asan_noinst_test.cc (this is more or less intentional),
so one shouldn't call intercepted functions in this test -- added a comment about this.

llvm-svn: 206477
2014-04-17 17:29:07 +00:00
Kostya Serebryany 664b1e2f9b [asan] fix a bug in outlined asan checks and in the corresponding test (ouch)
llvm-svn: 206470
2014-04-17 14:38:25 +00:00
Alexey Samsonov aefbec9dfd Move pthread_cond_* interceptors from sanitizer_common with all the ugly hacks to TSan
llvm-svn: 206423
2014-04-16 23:06:46 +00:00
Kostya Serebryany ae401ca5e7 [asan] add __asan_load1/__asan_store1/... callbacks to asan-rt; together with -mllvm -asan-instrumentation-with-call-threshold=N this will be a workaround for PR17409
llvm-svn: 206387
2014-04-16 13:52:28 +00:00
Kostya Serebryany 498b18a01e [asan] try to harden __tls_get_addr interceptor against signals (no good test still); update the comment in a test.
llvm-svn: 206367
2014-04-16 09:07:27 +00:00
Kostya Serebryany d4b1b2068e [asan] fix the alloctor code to not use opaque data structure, which was larger than needed. This was a leftover of the allocator1=>allocator2 migration; thanks Yuri Gribov for reminding
llvm-svn: 206280
2014-04-15 13:30:32 +00:00
Alexander Potapenko 65a6c57013 [ASan] Replace a CHECK for mmap_limit_mb with a RAW_CHECK.
In the case of a CHECK failure the program tries to fork and launch llvm-symbolizer,
but hangs in mz_force_lock because one of the allocator locks is already acquired.

llvm-svn: 206274
2014-04-15 11:36:18 +00:00