Commit Graph

3595 Commits

Author SHA1 Message Date
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
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
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
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
Kostya Serebryany b1232474b2 [asan] try fixing the mmap_limit_mb failure on buildbot (tests pass locally)
llvm-svn: 206262
2014-04-15 08:35:43 +00:00
Hans Wennborg 8f80ccc635 sanitizer_atomic_msvc.h: add atomic_fetch_{add,sub} overloads for uintptr_t
This should hopefully unbreak the MSVC build after r206178.

llvm-svn: 206200
2014-04-14 17:43:49 +00:00
Hans Wennborg ec77f619bb sanitizer_deadlock_detector.h: MSVC 2012 doesn't like compound literals
llvm-svn: 206199
2014-04-14 17:43:45 +00:00
Evgeniy Stepanov 9ce9a6cdf6 [msan] Intercept wcsftime().
llvm-svn: 206179
2014-04-14 14:59:42 +00:00
Kostya Serebryany bcfbea6d4e [asan] added internal flag mmap_limit_mb
llvm-svn: 206178
2014-04-14 14:51:01 +00:00
Kostya Serebryany 90527cb324 [asan] don't use bool in public interface, make sure the interface headers are usable in plain C
llvm-svn: 206160
2014-04-14 11:16:53 +00:00
Kostya Serebryany f694ab1f18 [asan] provide better reports for cases where memcpy/etc get negative size parameter. Also fix a typo found by Tetsuo Kiso
llvm-svn: 206158
2014-04-14 09:50:52 +00:00
Dmitry Vyukov 51f5b5fd73 tsan: serialize report printing in standalone deadlock detector
otherwise reports get intermixed

llvm-svn: 206043
2014-04-11 17:54:27 +00:00
Dmitry Vyukov b5eb8f0212 tsan: fix vector clocks
the new optimizations break when thread ids gets reused (clocks go backwards)
add the necessary tests as well

llvm-svn: 206035
2014-04-11 15:38:03 +00:00
Dmitry Vyukov fa1d56c31f tsan: ignore interceptors from symbolizer
ocassionally we see races coming from symbolizer interceptors (e.g. memcmp)
reproducible only only on large complex programs

llvm-svn: 206034
2014-04-11 15:36:54 +00:00
Evgeniy Stepanov 652cbd7c15 [tsan] Fix false positive on xdr*_create.
llvm-svn: 206030
2014-04-11 12:29:24 +00:00
Evgeniy Stepanov d326c81117 [msan] mprotect() more memory to detect user code outside of application range.
llvm-svn: 206028
2014-04-11 12:04:29 +00:00
Viktor Kutuzov 7004b8c07c Enable building of sanitizers on FreeBSD
llvm-svn: 205919
2014-04-09 18:45:12 +00:00
Viktor Kutuzov 82185a2088 Declare _DYNAMIC and dl_phdr_info in asan_linux.cc on FreeBSD
llvm-svn: 205852
2014-04-09 13:37:19 +00:00
Evgeniy Stepanov 24c8d92fec [sanitizer] Intercept a subset of sunrpc interface (xdr_*).
llvm-svn: 205627
2014-04-04 14:51:23 +00:00
Evgeniy Stepanov f653cda269 [msan] Introduce MsanThread. Move thread-local allocator cache out of TLS.
This reduces .tbss from 109K down to almost nothing.

llvm-svn: 205618
2014-04-04 09:47:41 +00:00
Kostya Serebryany 9f20c9b17c [asan] fix a leak in __tls_get_addr handler; introduce a run-time flag to disable this handler completely; remove a workaround for a bug fixed in glibc
llvm-svn: 205617
2014-04-04 09:10:58 +00:00
Alexey Samsonov 425314a65f [TSan] Fix a rare deadlock on multithreaded fork.
If a multi-threaded program calls fork(), TSan ignores all memory accesses
in the child to prevent deadlocks in TSan runtime. This is OK, as child is
probably going to call exec() as soon as possible. However, a rare deadlocks
could be caused by ThreadIgnoreBegin() function itself.

ThreadIgnoreBegin() remembers the current stack trace and puts it into the
StackDepot to report a warning later if a thread exited with ignores enabled.
Using StackDepotPut in a child process is dangerous: it locks a mutex on
a slow path, which could be already locked in a parent process.

The fix is simple: just don't put current stack traces to StackDepot in
ThreadIgnoreBegin() and ThreadIgnoreSyncBegin() functions if we're
running after a multithreaded fork. We will not report any
"thread exited with ignores enabled" errors in this case anyway.

Submitting this without a testcase, as I believe the standalone reproducer
is pretty hard to construct.

llvm-svn: 205534
2014-04-03 12:51:26 +00:00
Alexey Samsonov b4525218d4 [TSan] Fix a typo ThreadIgnoreSyncEnd. Found by inspection
llvm-svn: 205531
2014-04-03 12:28:16 +00:00