Saleem Abdulrasool
a374f43ec8
builtins: add missing file
...
Add (missing) definition of COMPILER_RT_EXPORT which is meant to be used for
decorating functions that are meant to be exported. This is useful for
platforms where exports and imports must be decorated explicitly (i.e. Windows).
llvm-svn: 208593
2014-05-12 16:47:01 +00:00
Saleem Abdulrasool
c17450236e
__clear_cache: decorate with COMPILER_RT_EXPORT
...
Use COMPILER_RT_EXPORT rather than COMPILER_RT_ABI for this function. Adding an
explicit PCS standard to the function causes a mismatch between the
declarations. Furthermore, the function is implemented in C, and should take
the CC based on the target triple.
llvm-svn: 208591
2014-05-12 16:28:11 +00:00
Saleem Abdulrasool
2e3ad036a2
CompilerRT: .align was supposed to be power-of-aligned in this case
...
Use .balign instead of .p2align 3. This should fix the buildbots.
llvm-svn: 208585
2014-05-12 16:06:11 +00:00
Saleem Abdulrasool
310874ae3c
[CompilerRT] use .p2align, .balign instead of .align
...
The .align statements in ARM assembly routines is actually meant to be a power
of 2 alignment (e.g. .align 2 == 4 byte alignment, not 2). Switch to using
.p2align. .p2align is guaranteed to be a power-of-two alignment always and much
more explicit.
The .align in the case of x86_64 is byte alignment, use .balign instead of
.align.
llvm-svn: 208578
2014-05-12 15:23:37 +00:00
Timur Iskhodzhanov
a9e9e9d640
[ASan tests] Don't define __asan_default_options in tests on Windows as it is not supported
...
llvm-svn: 208575
2014-05-12 15:12:44 +00:00
Timur Iskhodzhanov
90278c626f
[ASan] Add references to the issue tracker about malloc/free/new/delete mismatch check on Mac and Windows
...
llvm-svn: 208574
2014-05-12 15:06:59 +00:00
Timur Iskhodzhanov
d5d5f6a8b9
[ASan tests] Exclude/simplify a bunch of tests to make them build on Windows
...
(This also requires D3720, D3725 and a few more small changes to land)
llvm-svn: 208573
2014-05-12 15:04:25 +00:00
Timur Iskhodzhanov
9bd988b33b
[ASan tests] Don't run FakeStack.CreateDestroy on Windows as it OOMs
...
llvm-svn: 208572
2014-05-12 14:49:17 +00:00
Timur Iskhodzhanov
36fc9b18b7
[ASan tests] Also define USED/UNUSED in lib/sanitizer_common/sanitizer_internal_defs.h if Clang is used on Windows
...
Otherwise we end up with macro redefinition warnings
llvm-svn: 208571
2014-05-12 14:44:29 +00:00
Timur Iskhodzhanov
9a205ed8ee
[ASan tests] Use the proper attribute on RunStrChrTest helper functions to avoid "unused function" warnings
...
llvm-svn: 208568
2014-05-12 14:31:57 +00:00
Sergey Matveev
f37bd92c3a
[asan] Move the "coverage" flag to common flags.
...
The implementation lives in sanitizer_common and will need to access that flag.
llvm-svn: 208566
2014-05-12 14:27:36 +00:00
Hal Finkel
10c6c06656
Define CRT_HAS_128BIT even for PPC32
...
r201909, which introduced CRT_HAS_128BIT, unintentionally broke self-hosting on
PPC32. We used to define CRT_HAS_128BIT only on LP64 systems, but this is not
quite right (at least for Clang-compiled code). Even though __int128 is not
supported on PPC32, SROA can (and does) still form i128 variables at the IR
level, and operations on those variables may turn into the associated runtime
calls. As a result, we still need to compile __ashlti3, __ashrti3, __lshrti3,
and perhaps others, on PPC32.
llvm-svn: 208560
2014-05-12 13:43:29 +00:00
Kostya Serebryany
118d469660
[asan] one more attempt to enable lsan by default (PR19521)
...
llvm-svn: 208545
2014-05-12 12:49:48 +00:00
Viktor Kutuzov
626edb6f49
Add FreeBSD support to address sanitizer process mapping facilities
...
llvm-svn: 208537
2014-05-12 11:03:46 +00:00
Kostya Serebryany
e61f4d5155
[tsan] force tls_model='initial-exec' for tsan's cur_thread_placeholder so that we don't depend on the compiler flags
...
llvm-svn: 208536
2014-05-12 10:40:33 +00:00
Kostya Serebryany
9c81b31568
[asan] define ASAN_DYNAMIC=1 if PIC is defined
...
llvm-svn: 208530
2014-05-12 09:45:39 +00:00
Kostya Serebryany
d7992fc921
[asan] fix a self deadlock when printing stats; add a relevant test, cleanup that test while at it to remove linux/darwin differences. Fixes http://code.google.com/p/address-sanitizer/issues/detail?id=306
...
llvm-svn: 208525
2014-05-12 08:01:51 +00:00
Duncan P. N. Exon Smith
59ad79601b
InstrProf: Remove redundant declaration
...
llvm-svn: 208464
2014-05-10 00:22:58 +00:00
Alexey Samsonov
eacb4d8417
[CMake] Use ExternalProject to build MSan-ified version of libcxx for unit tests.
...
This change lets MSan rely on libcxx's own build system instead of manually
compiling its sources and setting up all the necessary compile flags. It would
also simplify compiling libcxx with another sanitizers (in particular, TSan).
The tricky part is to make sure libcxx is reconfigured/rebuilt when Clang or
MSan runtime library is changed. "clobber" step used in this patch works well
for me, but it's possible it would break for other configurations - will
watch the buildbots.
llvm-svn: 208451
2014-05-09 22:11:03 +00:00
Alexey Samsonov
35744c4753
Fixup for r208066. Properly get values of PTRACE_GETREGSET/PTRACE_SETREGSET.
...
llvm-svn: 208363
2014-05-08 22:11:20 +00:00
Sergey Matveev
76e02e90c5
[ASan] Fix coverage behavior when a PC belongs to an unknown address range.
...
This happens, e.g., when coverage data is collected for a module which is then
dlclose()'d. Currently this causes CovDump() to ignore all PCs that are greater
than the unrecognized PC. In other words, unloading a module causes ASan to
silently ignore any coverage data for modules loaded at higher addresses.
Instead we should just skip the unrecognized PCs.
llvm-svn: 208333
2014-05-08 16:09:54 +00:00
Timur Iskhodzhanov
e153347cc5
[ASan tests] Fix non-Windows breakage
...
llvm-svn: 208332
2014-05-08 15:59:35 +00:00
Timur Iskhodzhanov
21a22d34be
[ASan tests] More progress towards Windows support
...
llvm-svn: 208326
2014-05-08 15:13:26 +00:00
Timur Iskhodzhanov
48253ed689
[ASan tests] More progress towards Windows support
...
llvm-svn: 208325
2014-05-08 15:05:42 +00:00
Timur Iskhodzhanov
498052b8eb
[ASan tests] More progress towards Windows support
...
llvm-svn: 208323
2014-05-08 15:01:29 +00:00
Timur Iskhodzhanov
fddadefc33
[ASan tests] Auto-define ASAN_NEEDS_SEGV rather than hardcode it in cmake
...
llvm-svn: 208322
2014-05-08 14:53:59 +00:00
Timur Iskhodzhanov
76f43eecb0
[ASan] Update sanitizer_common and asan test_util headers to support building on Windows
...
llvm-svn: 208306
2014-05-08 12:43:33 +00:00
Evgeniy Stepanov
c5e51926dc
[msan] Intercept strxfrm.
...
llvm-svn: 208303
2014-05-08 12:04:01 +00:00
Evgeniy Stepanov
ac030ffb69
[msan] Switch to common printf interceptors.
...
Format string parsing is disabled by default.
This is not expected to meaningfully change the tool behavior.
With this change, check_printf flag could be used to evaluate printf format
string parsing in MSan.
llvm-svn: 208295
2014-05-08 09:50:59 +00:00
Evgeniy Stepanov
d31ac26230
[sanitizer] Unconditionally write to target buffer in *sprintf interceptors.
...
This does not change the default behavior (check_printf in on by default in all tools).
With this change, check_printf flag only affects format string parsing.
llvm-svn: 208290
2014-05-08 09:18:22 +00:00
Alexey Samsonov
2fccdfbe70
[MSan] Fixup for r206983: MsanThread may be unavailable in signal handler: signals may be raised while thread is being destroyed
...
llvm-svn: 208250
2014-05-07 21:23:12 +00:00
Timur Iskhodzhanov
6d58e0726d
Ignore stack-buffer-overflow in std::_Find_elem<*> / std::num_get<...>::_Getifld
...
Reviewed at http://reviews.llvm.org/D3650
llvm-svn: 208215
2014-05-07 14:40:23 +00:00
Evgeniy Stepanov
7d46040ff2
[sanitizer] Replace a macro with a function.
...
llvm-svn: 208207
2014-05-07 13:24:28 +00:00
Evgeniy Stepanov
55590227f8
[sanitizer] Intercept obstack.
...
llvm-svn: 208196
2014-05-07 11:50:56 +00:00
Evgeniy Stepanov
8dd62dc3be
[msan] Fix __msan_check_mem_is_initialized and prettify its output.
...
llvm-svn: 208195
2014-05-07 11:50:14 +00:00
Evgeniy Stepanov
c087df0655
[asan] Include asm instrumentation source in Makefile build.
...
llvm-svn: 208172
2014-05-07 08:55:46 +00:00
Kostya Serebryany
7a733480c8
[asan] introduce interface function __sanitizer_verify_contiguous_container to verify annotations in vector-like containers
...
llvm-svn: 208092
2014-05-06 14:41:01 +00:00
Evgeniy Stepanov
aa44aaee90
[sanitizer] Print addresses in hexadecimal.
...
llvm-svn: 208089
2014-05-06 14:01:13 +00:00
Timur Iskhodzhanov
7d5c81db0a
[ASan/Win] Don't crash when ASAN_OPTIONS have disable_core=1
...
Reviewed at http://reviews.llvm.org/D3610
llvm-svn: 208070
2014-05-06 08:21:50 +00:00
Kostya Serebryany
98e55ef41a
[sanitizer] fix build with glibc 2.4, patch by Sandra Loosemore
...
llvm-svn: 208066
2014-05-06 07:36:51 +00:00
Timur Iskhodzhanov
7721eb3f9d
[ASan/Win] Add DLL thunks for the fake stack interface
...
llvm-svn: 207960
2014-05-05 12:26:04 +00:00
Dmitry Vyukov
3089608172
tsan: disable debug output in normal mode
...
llvm-svn: 207954
2014-05-05 07:45:54 +00:00
Reid Kleckner
af6b2504f8
profile: Fix the build with gcc 4.9
...
GCC -pedantic warns that the initialization of Header is not constant:
InstrProfilingFile.c:31:5: error: initializer element is not computable at load time [-Werror]
LLVM defaults to enabling -pedantic. If this warning is unhelpful, we
can consider revisiting that decision.
llvm-svn: 207784
2014-05-01 18:52:14 +00:00
Kostya Serebryany
12963b54a8
[asan] disable GetKernelStartAddress as it misbehaves in schroot
...
llvm-svn: 207768
2014-05-01 16:20:23 +00:00
Chandler Carruth
c42ddde78a
The newest versions of CMake require outputs of custom commands be in
...
DEPENDS rather than SOURCES. The SOURCES just end up looking on the
filesystem and not finding anything. Makes for very hard to debug build
errors. =/
llvm-svn: 207722
2014-04-30 23:31:45 +00:00
Kostya Serebryany
8b530e10a1
[asan] make AsanCoverage lock-free (and AS-safe)
...
llvm-svn: 207630
2014-04-30 10:40:48 +00:00
Evgeniy Stepanov
fe250b0014
[msan] Prettify __msan_print_shadow.
...
Makes __msan_print_shadow output much more readable, adds origin info.
llvm-svn: 207622
2014-04-30 09:50:30 +00:00
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
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
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
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
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
Alexey Samsonov
11ff0a26a4
[ASan] Fix incompatible runtimes check: don't iterate /proc/self/maps on every call to __asan_init
...
llvm-svn: 205418
2014-04-02 13:09:22 +00:00
Evgeniy Stepanov
2dcb5c0a2c
[msan] Kill __msan_print_param_shadow.
...
It does not do what it's name says, and what it actually does is hard to
describe, and is not useful at all.
llvm-svn: 205415
2014-04-02 11:55:24 +00:00
Evgeniy Stepanov
80cb930c09
[msan] Add __msan_check_mem_is_initialized.
...
An assert()-like function that checks that a memory range is fully initialized.
llvm-svn: 205413
2014-04-02 11:50:42 +00:00
Evgeniy Stepanov
a55fcd35e9
[msan] Precise origin handling in __unaligned_(load|store)*.
...
llvm-svn: 205412
2014-04-02 11:06:35 +00:00
Alexey Samsonov
2c66a22e56
[ASan] One more attempt to fix Android build
...
llvm-svn: 205411
2014-04-02 09:36:36 +00:00
Evgeniy Stepanov
8dbf3faa16
[msan] clang-format several unit tests
...
llvm-svn: 205410
2014-04-02 09:17:55 +00:00
Joerg Sonnenberger
a350ba4883
Move __addsf3 and __adddf3 into the corresponding blocks that define
...
fp_t.
llvm-svn: 205344
2014-04-01 18:39:58 +00:00
Alexander Potapenko
f3e92a9e71
[tsan] Remove an accidentally committed debug print.
...
llvm-svn: 205316
2014-04-01 15:07:09 +00:00
Joerg Sonnenberger
6530149704
Add support for IEEE754 quad precision comparison functions.
...
From GuanHong Liu.
Differential Revision: http://llvm-reviews.chandlerc.com/D2797
llvm-svn: 205312
2014-04-01 13:42:56 +00:00
Alexey Samsonov
107e4abfd0
[ASan] Fix Android build
...
llvm-svn: 205311
2014-04-01 13:42:16 +00:00
Alexey Samsonov
56b6ee9833
[ASan] Optional support for dynamic ASan runtime on Linux.
...
Based on http://llvm-reviews.chandlerc.com/D3042 by Yuri Gribov!
llvm-svn: 205308
2014-04-01 13:16:30 +00:00
Viktor Kutuzov
7fedc179d2
Add FreeBSD support to sanitizers' procmaps facilities
...
llvm-svn: 205291
2014-04-01 10:34:21 +00:00
Viktor Kutuzov
3ece65b894
Fix definition of the __sanitizer_passwd structure on FreeBSD
...
llvm-svn: 205290
2014-04-01 10:29:42 +00:00
Duncan P. N. Exon Smith
ae2f0bbcf1
InstrProf: Add simple compiler-rt test
...
Add the test infrastructure for testing lib/profile and a single test.
This initial commit only enables the tests on Darwin, but they'll be
enabled on Linux soon after.
<rdar://problem/16458307>
llvm-svn: 205256
2014-03-31 22:45:37 +00:00
Evgeniy Stepanov
3c95744de8
[msan] Remove an extra top frame from track-origins=2 reports.
...
llvm-svn: 205192
2014-03-31 14:18:55 +00:00
Alexey Samsonov
78a8435fd6
[CMake] Rename add_compiler_rt_static_runtime to add_compiler_rt_runtime.
...
Soon there will be an option to build compiler-rt parts as shared libraries
on Linux. Extracted from http://llvm-reviews.chandlerc.com/D3042
by Yuri Gribov.
llvm-svn: 205183
2014-03-31 13:45:36 +00:00
Alexander Potapenko
0426176940
[TSan] Replace several Printf() calls with Report() to ease debugging.
...
llvm-svn: 205175
2014-03-31 10:46:07 +00:00
Kostya Serebryany
683d55f50e
[sanitizer] speed up the bitvector-based deadlock detector by ~15% (iterate over the currently held locks using the array, not the bitvector. Bitvector is not the best data structure to iterate over)
...
llvm-svn: 205168
2014-03-31 07:23:50 +00:00
Evgeniy Stepanov
6f34082590
[sanitizer] Fix Mac build.
...
llvm-svn: 205006
2014-03-28 14:01:40 +00:00
Evgeniy Stepanov
86a4d2c32b
[sanitizer] Intercept fgetpwent / fgetgrent.
...
These interceptors require deep unpoisoning of return values.
While at it, we do the same for all other pw/gr interceptors to
reduce dependency on libc implementation details.
llvm-svn: 205004
2014-03-28 13:03:55 +00:00
Evgeniy Stepanov
163ee4efb5
[sanitizer] Intercept setpwent/endpwent.
...
It's hard to write a reliable test for this code because they
work with unpredictable memory locations. But this change should
fix current failures in getpwent() tests on the sanitizer bots.
llvm-svn: 205002
2014-03-28 11:46:35 +00:00
Evgeniy Stepanov
92bee36b3e
[sanitizer] Intercept rand_r.
...
llvm-svn: 205001
2014-03-28 11:21:45 +00:00
Evgeniy Stepanov
74e77756ef
[sanitizer] Intercept getpwent/getgrent.
...
llvm-svn: 205000
2014-03-28 10:56:07 +00:00
Joerg Sonnenberger
ea1f8fb775
Add instrastructure for IEEE quad precision.
...
Based on patch from GuanHong Liu.
Differential Revision: http://llvm-reviews.chandlerc.com/D2796
llvm-svn: 204999
2014-03-28 10:29:31 +00:00
Evgeniy Stepanov
2e972f63b5
[sanitizer] Intercept mktime.
...
llvm-svn: 204994
2014-03-28 09:02:57 +00:00
Evgeniy Stepanov
7b44e1ad42
[sanitizer] Intercept ftime.
...
llvm-svn: 204991
2014-03-28 08:33:32 +00:00
Evgeniy Stepanov
a6eb1bb59e
[sanitizer] Intercept __bzero on Mac.
...
This should make memset_test pass on Mac.
llvm-svn: 204929
2014-03-27 14:20:34 +00:00
Evgeniy Stepanov
1189734413
[sanitizer] Fix Android build.
...
llvm-svn: 204927
2014-03-27 14:06:15 +00:00
Evgeniy Stepanov
89602651e8
[msan] Implement __msan_set_death_callback.
...
llvm-svn: 204926
2014-03-27 14:04:58 +00:00
Timur Iskhodzhanov
e6303d1224
Add support for _expand[_dbg] so we don't crash when _aligned_* allocation functions are used
...
llvm-svn: 204925
2014-03-27 14:01:11 +00:00
Evgeniy Stepanov
9dcd5a353a
[msan] Intercept several malloc-related functions.
...
llvm-svn: 204923
2014-03-27 13:29:29 +00:00
Kostya Serebryany
88d0eac412
[asan] Do not sanitize kernel area on 32-bit targets, patch by Yuri Gribov
...
llvm-svn: 204897
2014-03-27 07:36:26 +00:00
Peter Collingbourne
5d167dae7d
Add function to get the number of DFSan labels allocated.
...
Expose the number of DFSan labels allocated by adding function dfsan_get_label_count().
Patch by Sam Kerner!
Differential Revision: http://llvm-reviews.chandlerc.com/D3109
llvm-svn: 204854
2014-03-26 21:09:53 +00:00
Rafael Espindola
5e46070516
Avoid aliases to weak aliases in interceptors.
...
The interceptors had code that after macro expansion ended up looking like
extern "C" void memalign()
__attribute__((weak, alias("__interceptor_memalign")));
extern "C" void __interceptor_memalign() {}
extern "C" void __interceptor___libc_memalign()
__attribute__((alias("memalign")));
That is,
* __interceptor_memalign is a function
* memalign is a weak alias to __interceptor_memalign
* __interceptor___libc_memalign is an alias to memalign
Both gcc and clang produce assembly that look like
__interceptor_memalign:
...
.weak memalign
memalign = __interceptor_memalign
.globl __interceptor___libc_memalign
__interceptor___libc_memalign = memalign
What it means in the end is that we have 3 symbols pointing to the
same position in the file, one of which is weak:
8: 0000000000000000 1 FUNC GLOBAL DEFAULT 1
__interceptor_memalign
9: 0000000000000000 1 FUNC WEAK DEFAULT 1 memalign
10: 0000000000000000 1 FUNC GLOBAL DEFAULT 1
__interceptor___libc_memalign
In particular, note that __interceptor___libc_memalign will always
point to __interceptor_memalign, even if we do link in a strong symbol
for memalign. In fact, the above code produces exactly the same binary
as
extern "C" void memalign()
__attribute__((weak, alias("__interceptor_memalign")));
extern "C" void __interceptor_memalign() {}
extern "C" void __interceptor___libc_memalign()
__attribute__((alias("__interceptor_memalign")));
If nothing else, this patch makes it more obvious what is going on.
llvm-svn: 204823
2014-03-26 15:48:59 +00:00
Dmitry Vyukov
5da31e03bf
tsan: fix deadlock during fork
...
ReportRace takes the two mutexes in the opposite order
llvm-svn: 204809
2014-03-26 14:13:31 +00:00
Dmitry Vyukov
b979a55607
tsan: fix another compiler-injected memset
...
newer gcc inserts memset here
llvm-svn: 204808
2014-03-26 14:13:00 +00:00
Evgeniy Stepanov
16d89fc356
[sanitizer] Intercept __aeabi_mem(set|cpy|move).
...
llvm-svn: 204800
2014-03-26 12:14:34 +00:00
Viktor Kutuzov
9068dfa6a7
Define uintptr_t in the profiling sources on x86_64 FreeBSD in 32-bit mode
...
llvm-svn: 204799
2014-03-26 12:00:44 +00:00
Alexander Potapenko
7caa0b9e36
[ASan] Fix a thinko spotted by Evgeniy Stepanov: use REAL(memcpy) on non-OSX systems.
...
llvm-svn: 204794
2014-03-26 11:18:25 +00:00
Evgeniy Stepanov
1382fabd97
[msan] Enable SelectPartial test.
...
Fixed in r204716.
llvm-svn: 204717
2014-03-25 13:09:14 +00:00
Evgeniy Stepanov
1611ed8879
[tsan] Fix more warnings in TSan tests.
...
llvm-svn: 204715
2014-03-25 13:01:32 +00:00
Evgeniy Stepanov
0f08043aeb
[tsan] Fix compiler warnings in TSan tests.
...
llvm-svn: 204712
2014-03-25 11:17:14 +00:00
Evgeniy Stepanov
517ff05ffb
[msan] Fix compiler warning in msan_test.cc.
...
llvm-svn: 204708
2014-03-25 10:03:39 +00:00
Evgeniy Stepanov
90384ad60e
[msan] A disabled test for inexact "select" instrumentation.
...
llvm-svn: 204707
2014-03-25 09:36:15 +00:00
Duncan P. N. Exon Smith
21b98a6c83
InstrProf: Change the extension of the default profile
...
Change the name of the default profile dumped by compiler-rt to
default.profraw. This distinguishes it more clearly from the
(incompatible) format output by llvm-profdata that is read by clang
-fprofile-instr-use.
llvm-svn: 204676
2014-03-24 21:53:42 +00:00
Dmitry Vyukov
d23118c3b2
tsan: optimize vector clock operations
...
Make vector clock operations O(1) for several important classes of use cases.
See comments for details.
Below are stats from a large server app, 77% of all clock operations are handled as O(1).
Clock acquire : 25983645
empty clock : 6288080
fast from release-store : 14917504
contains my tid : 4515743
repeated (fast) : 2141428
full (slow) : 2636633
acquired something : 1426863
Clock release : 2544216
resize : 6241
fast1 : 197693
fast2 : 1016293
fast3 : 2007
full (slow) : 1797488
was acquired : 709227
clear tail : 1
last overflow : 0
Clock release store : 3446946
resize : 200516
fast : 469265
slow : 2977681
clear tail : 0
Clock acquire-release : 820028
llvm-svn: 204656
2014-03-24 18:54:20 +00:00
Dmitry Vyukov
f49921ba53
tsan: reorder SyncVar members to reduce contention
...
llvm-svn: 204655
2014-03-24 18:51:37 +00:00
Dmitry Vyukov
781eca5f71
tsan: use read lock instead of write in atomic operations when possible
...
llvm-svn: 204654
2014-03-24 18:51:13 +00:00
Alexey Samsonov
c41ca6d31a
[CMake] Rename the variable
...
llvm-svn: 204602
2014-03-24 13:29:20 +00:00
Timur Iskhodzhanov
59ce9e07a4
Fix a VS compile-time warning
...
warning C4345: behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized
llvm-svn: 204597
2014-03-24 10:47:37 +00:00
Viktor Kutuzov
276fefb8d9
A fix for sanitizers' TLS support on FreeBSD
...
llvm-svn: 204595
2014-03-24 10:01:54 +00:00
Alexey Samsonov
1847401332
[CMake] Respect CMAKE_CXX_FLAGS in custom clang_compile commands
...
llvm-svn: 204593
2014-03-24 09:42:12 +00:00
Alexey Samsonov
8c956460d3
Make MSan unittest -Werror=sign-compare clean
...
llvm-svn: 204592
2014-03-24 09:41:11 +00:00
Evgeniy Stepanov
ce002ad3b2
[asan] Disable setjmp/sigsetjmp tests.
...
Failing due to PR19207.
llvm-svn: 204590
2014-03-24 08:30:59 +00:00
Evgeniy Stepanov
d7f06ee3c7
[asan] Fix a comment.
...
llvm-svn: 204589
2014-03-24 08:27:31 +00:00
Duncan P. N. Exon Smith
96cf6c3892
InstrProf: Indicate pointer size in raw profile
...
Since the profile can come from 32-bit machines, the reader needs to
check the pointer size. Change the magic number to facilitate this.
<rdar://problem/16400648>
llvm-svn: 204556
2014-03-23 03:38:05 +00:00
David Blaikie
089b5c9174
Avoid GCC's "cast from pointer to integer of different size" warning.
...
This is a bit of a stab in the dark as I'm not sure I've got these
source files compiling correctly locally. (and the warning only
reproduces on a 32bit build anyway)
llvm-svn: 204521
2014-03-21 21:45:49 +00:00
Duncan P. N. Exon Smith
8d02a2ac21
InstrProf: Remove MSVC-specific logic
...
Apparently, MSVC has stdint.h now? Let's see if the buildbots complain.
I'm not convinced that the build system is even set up for MSVC to build
this file, but...
llvm-svn: 204515
2014-03-21 20:59:08 +00:00
Duncan P. N. Exon Smith
a128956243
InstrProf: Change magic number to have non-text characters
...
Include non-text characters in the magic number so that text files can't
match.
<rdar://problem/15950346>
llvm-svn: 204514
2014-03-21 20:42:40 +00:00
Duncan P. N. Exon Smith
f1c9361326
InstrProf: __ => _ in header guards
...
llvm-svn: 204502
2014-03-21 18:47:23 +00:00
Duncan P. N. Exon Smith
812dcae09c
InstrProf: Unify logic in two profile writers
...
<rdar://problem/15943240>
llvm-svn: 204500
2014-03-21 18:29:24 +00:00
Duncan P. N. Exon Smith
117cf2bd1f
InstrProf: Write the __llvm_profile_write_buffer()
...
Write __llvm_profile_write_buffer(), which uses the same logic as
__llvm_profile_write_file(), but writes directly to a provided `char*`
buffer instead.
<rdar://problem/15943240>
llvm-svn: 204499
2014-03-21 18:29:22 +00:00
Duncan P. N. Exon Smith
cf4bb960bd
InstrProf: If libc is available, use it; no functionality change
...
It was misguided to plan to rely on __llvm_profile_write_buffer() in
__llvm_profile_write_file(). It's less complex to duplicate the writing
logic than to mmap the file.
Since it's here to stay, move `FILE*`-based writing logic into
InstrProfilingFile.c.
<rdar://problem/15943240>
llvm-svn: 204498
2014-03-21 18:29:19 +00:00
Duncan P. N. Exon Smith
be0a5e176b
InstrProf: Reorganize files; no functionality change
...
Move functions around to prepare for some other changes.
- Merge InstrProfilingExtras.h with InstrProfiling.h. There's no
benefit to having these split.
- Rename InstrProfilingExtras.c to InstrProfilingFile.c.
- Split actual buffer writing code out of InstrProfiling.c into
InstrProfilingBuffer.c.
- Drive-by corrections of a couple of header comments.
<rdar://problem/15943240>
llvm-svn: 204497
2014-03-21 18:29:15 +00:00
Duncan P. N. Exon Smith
76e8731b09
InstrProf: Write raw binary profile from runtime
...
Write a raw binary profile from the runtime.
<rdar://problem/15950346>
llvm-svn: 204495
2014-03-21 18:25:56 +00:00
Alexander Potapenko
25e204e194
[libsanitizer] Add descriptions for the common flags.
...
Use new(allocator_for_flags) instead of allocator_for_flags.Allocate()
Fix the description output format a bit.
llvm-svn: 204484
2014-03-21 17:28:12 +00:00
Kostya Serebryany
3df5d87da4
[sanitizer] print threads in deadlock report
...
llvm-svn: 204461
2014-03-21 13:00:18 +00:00
Kostya Serebryany
7317d9499b
[sanitizer] more human-readable deadlock reports
...
llvm-svn: 204454
2014-03-21 11:37:43 +00:00
Sergey Matveev
fa76f3b3a5
[MSan] Add __msan_unpoison_string() to the public interface.
...
Using __msan_unpoison() on null-terminated strings is awkward because
strlen() can't be called on a poisoned string. This case warrants a special
interface function.
llvm-svn: 204448
2014-03-21 10:12:17 +00:00
Alexander Potapenko
c6afaace15
[ASan] Move the flag descriptions from comments to ParseFlag arguments.
...
llvm-svn: 204440
2014-03-21 08:37:59 +00:00
Greg Fitzgerald
8288afb5fe
fixed check_lint.sh in standalone build
...
Change-Id: I30d340bbe6b2028cc0f831399b62521912dcac60
llvm-svn: 204419
2014-03-21 00:45:21 +00:00
Duncan P. N. Exon Smith
4543aac96e
PGO: Indicate errors in profile runtime API
...
Return 0 for success, non-0 for failure.
llvm-svn: 204415
2014-03-21 00:27:50 +00:00
Duncan P. N. Exon Smith
e5edc8869b
PGO: Substitute pid for %p in filename
...
Add logic to do a printf-style substitution of %p for the process pid in
the filename.
It's getting increasingly awkward to work on lib/profile without test
infrastructure. This needs to be fixed!
<rdar://problem/16383358>
llvm-svn: 204414
2014-03-21 00:27:48 +00:00
Duncan P. N. Exon Smith
71704754d6
PGO: Declare zero-argument C functions as foo(void)
...
It turns out this is C code. Specify foo(void).
<rdar://problem/15943240>
llvm-svn: 204396
2014-03-20 20:55:00 +00:00
Duncan P. N. Exon Smith
9edbae0f16
PGO: Change runtime prefix from pgo to profile
...
These functions are in the profile runtime. PGO comes later.
Unfortunately, there's only room for 16 characters in a Darwin section,
so use __llvm_prf_ instead of __llvm_profile_ for section names.
<rdar://problem/15943240>
llvm-svn: 204391
2014-03-20 20:00:44 +00:00
Duncan P. N. Exon Smith
f1212176ac
PGO: Add function to reset counters at runtime
...
Adding __llvm_pgo_reset_counters(), which sets all the counters to 0.
<rdar://problem/15943240>
llvm-svn: 204386
2014-03-20 19:44:31 +00:00
Duncan P. N. Exon Smith
c962cda1db
PGO: Add missing file...
...
llvm-svn: 204384
2014-03-20 19:39:01 +00:00
Duncan P. N. Exon Smith
54cc0e2d81
PGO: Update interface for writing instrumentation data to file
...
__llvm_pgo_write_default_file() was a bad name, since it checked the
environment (it wasn't just a default file).
- Change __llvm_pgo_write_file() to __llvm_pgo_write_file_with_name()
and make it static.
- Rename __llvm_pgo_write_default_file() to __llvm_pgo_write_file().
- Add __llvm_pgo_set_filename(), which sets the filename for
subsequent calls to __llvm_pgo_write_file().
<rdar://problem/15943240>
llvm-svn: 204381
2014-03-20 19:23:55 +00:00
Duncan P. N. Exon Smith
775c178a90
PGO: Add explicit static initialization
...
Instead of relying on explicit static initialization from translation
units, create a new file, InstrProfilingRuntime.cc, with an
__llvm_pgo_runtime variable. After this commit (and its pair in clang),
the driver will create a use of this variable. Unless the user defines
their own version, the new object file will get pulled in, including
that C++ static initialization that calls
__llvm_pgo_register_write_atexit.
The result is that, at least on Darwin, static initialization typically
consists of a single function call, which registers a writeout functino
atexit. Furthermore, users can skip even this behaviour by defining
their own __llvm_pgo_runtime.
<rdar://problem/15943240>
llvm-svn: 204380
2014-03-20 19:23:53 +00:00
Duncan P. N. Exon Smith
9cee5e0e92
PGO: Moving files for clarity
...
<rdar://problem/15943240>
llvm-svn: 204373
2014-03-20 18:43:09 +00:00
Alexander Potapenko
d23359c3e3
[libsanitizer] Implement IntrusiveList<T>::Iterator, use IntrusiveList in sanitizer_flags.cc
...
llvm-svn: 204342
2014-03-20 13:49:21 +00:00
Alexander Potapenko
1296436cbf
[libsanitizer] Introduce flag descriptions.
...
Extend ParseFlag to accept the |description| parameter, add dummy values for all existing flags.
As the flags are parsed their descriptions are stored in a global linked list.
The tool can later call __sanitizer::PrintFlagDescriptions() to dump all the flag names and their descriptions.
Add the 'help' flag and make ASan, TSan and MSan print the flags if 'help' is set to 1.
llvm-svn: 204339
2014-03-20 12:52:52 +00:00
Dmitry Vyukov
d3466b9e5e
tsan: remove unused function declarations
...
llvm-svn: 204328
2014-03-20 10:39:46 +00:00
Dmitry Vyukov
c9e12aa323
tsan: deobfuscate global ctx variable
...
llvm-svn: 204327
2014-03-20 10:36:20 +00:00
Dmitry Vyukov
6e2557769c
tsan: use stack depot for goroutine creation stacks (as C++ threads do)
...
llvm-svn: 204326
2014-03-20 10:19:02 +00:00
Dmitry Vyukov
9cf08c46a6
tsan: remove unused declaration
...
llvm-svn: 204324
2014-03-20 10:13:30 +00:00
Duncan P. N. Exon Smith
ecf2256dfe
PGO: Implement Darwin linker magic for instrumentation
...
Use Darwin linker magic to find bounds of instrumentation data sections
at link time instead of runtime.
<rdar://problem/15943240>
llvm-svn: 204302
2014-03-20 03:57:33 +00:00
Duncan P. N. Exon Smith
da0de8a237
PGO: Split out initialization of section bounds
...
Currently we register instrumentation data at runtime to determine the
bounds of the sections where the data lives. Soon we'll implement
platform-specific linker magic to determine this at link time.
Move this logic to a separate file, so that our build system can choose
the correct platform-specific code.
No functionality change intended.
<rdar://problem/15943240>
llvm-svn: 204299
2014-03-20 03:23:10 +00:00
Duncan P. N. Exon Smith
a84dae2c2c
PGO: Constify references to instrumentation data
...
<rdar://problem/15943240>
llvm-svn: 204298
2014-03-20 03:19:15 +00:00
Duncan P. N. Exon Smith
d1a3bebeeb
PGO: Use past-the-end semantics for pointer range
...
llvm-svn: 204278
2014-03-19 22:45:28 +00:00
Duncan P. N. Exon Smith
8353a26e85
PGO: Splitting implementation files; no functionality change
...
Split implementation files along a uses-libc/shouldn't-use-libc
boundary.
- InstrProfiling.h is a shared header.
- InstrProfiling.c provides an API to extract profiling data from the
runtime, but avoids the use of libc. Currently this is a lie:
__llvm_pgo_write_buffer() uses `FILE*` and related functions. It
will be updated soon to write to a `char*` buffer instead.
- InstrProfilingExtras.c provides a more convenient API for
interfacing with the profiling runtime, but has logic that does (and
will continue to) use libc.
<rdar://problem/15943240>
llvm-svn: 204268
2014-03-19 22:10:27 +00:00
Duncan P. N. Exon Smith
61c97335c6
PGO: Fix obviously wrong typedefs for MS
...
llvm-svn: 204267
2014-03-19 22:10:24 +00:00
Dmitry Vyukov
1af191e1f4
tsan: add test for second_deadlock_stack flag
...
llvm-svn: 204240
2014-03-19 15:00:38 +00:00
Alexey Samsonov
a2fdd8e253
[CMake] Fix build of ASan tests on Mac
...
llvm-svn: 204238
2014-03-19 14:45:40 +00:00
Kostya Serebryany
78f2e7bd62
[sanitizer] use some c++11 to simplify the code (we can now). Fix one place where a mutex acquisition stack trace was not properly remembered
...
llvm-svn: 204237
2014-03-19 14:19:31 +00:00
Alexey Samsonov
17703c1092
[CMake] Build sanitizer unit tests with -std=c++11
...
llvm-svn: 204234
2014-03-19 13:57:33 +00:00
Kostya Serebryany
2483acce21
[sanitizer] when recycling deadlock graph nodes, properly recycle edges
...
llvm-svn: 204233
2014-03-19 13:53:37 +00:00
Dmitry Vyukov
cc579aeba6
tsan: use attribute instead of compiler flag for tls-model=initial-exec as asked in comments for r203111
...
llvm-svn: 204232
2014-03-19 13:24:52 +00:00
Dmitry Vyukov
ecc3456fd6
tsan: fix copy-pasted comment
...
llvm-svn: 204231
2014-03-19 13:19:39 +00:00
Dmitry Vyukov
bbbe6bba8a
tsan: preliminary support for Go deadlock detector
...
llvm-svn: 204228
2014-03-19 12:50:47 +00:00
Dmitry Vyukov
17efa197bf
tsan: fix large stack frame in deadlock detector
...
In member function 'virtual void __sanitizer::DD::MutexBeforeLock(__sanitizer::DDCallback*, __sanitizer::DDMutex*, bool)':
error: the frame size of 544 bytes is larger than 512 bytes [-Werror=frame-larger-than=]
The code is now [arguably] better as well.
llvm-svn: 204227
2014-03-19 12:49:46 +00:00
Kostya Serebryany
2ea796e05f
[sanitizer] deadlock detector: a) initial support for suppressions, b) be more robust in case we failed to extract a stack trace for one of the locks
...
llvm-svn: 204225
2014-03-19 12:26:33 +00:00
Timur Iskhodzhanov
364b8b8fe5
[ASan] Print mmap errno/GetLastError in a readable and consistent way
...
Reviewed at http://llvm-reviews.chandlerc.com/D3107
llvm-svn: 204218
2014-03-19 08:23:00 +00:00
Joerg Sonnenberger
4e08a634e1
Don't take short cuts trying to avoid conditionals. This leads to
...
negative shift amounts and/or shifts wider than the type. VAX traps on
the former, X86 and other platforms produce incorrect results on the
latter.
llvm-svn: 204193
2014-03-18 22:10:36 +00:00
Justin Bogner
bc9c856161
profile: Include the function hash in PGO profiles
...
llvm-svn: 204185
2014-03-18 21:57:58 +00:00
Joerg Sonnenberger
bbc979be52
Spacing
...
llvm-svn: 204179
2014-03-18 20:41:31 +00:00
Sergey Matveev
34b26458cb
[sanitizer] Fix a bug in AdjustStackSize().
...
If the user requests OS default stack size, do not adjust it to our minimum
stack size (which is usually much less than the OS default).
llvm-svn: 204173
2014-03-18 19:48:48 +00:00
Dmitry Vyukov
c5b7c66bc3
tsan: fix malloc/munmap mismatch
...
llvm-svn: 204154
2014-03-18 14:28:17 +00:00
Evgeniy Stepanov
412d973980
[msan] Origin tracking with history, compiler-rt part.
...
Compiler-rt part of MSan implementation of advanced origin tracking,
when we record not only creation point, but all locations where
an uninitialized value was stored to memory, too.
llvm-svn: 204152
2014-03-18 13:45:19 +00:00
Dmitry Vyukov
3cd028c0b2
tsan: deadlock detector: add deadlock detector flags
...
the first flags is to enable printing of the second stack per edge
llvm-svn: 204150
2014-03-18 13:13:47 +00:00
Dmitry Vyukov
b72bc2ec9c
tsan: deadlock detector: print 2 stacks per deadlock edge
...
llvm-svn: 204149
2014-03-18 12:53:05 +00:00
Dmitry Vyukov
7fbceb2a3f
tsan: addrhashmap: fix bug with initialization of addresses in add array
...
llvm-svn: 204148
2014-03-18 12:52:11 +00:00
Dmitry Vyukov
17fff3268d
tsan: deadlock detector: add ability to ignore destruction of global mutexes
...
llvm-svn: 204146
2014-03-18 12:50:41 +00:00
Dmitry Vyukov
9e5341d64a
tsan: lazily initialize deadlock detector runtime
...
this is necessaary because dlsym can call malloc, which can lock mutexes that we intercept
llvm-svn: 204141
2014-03-18 11:23:51 +00:00
Alexey Samsonov
f88f317d35
Fix -Werror build
...
llvm-svn: 204139
2014-03-18 11:17:01 +00:00
Dmitry Vyukov
3458425d81
tsan: support up to 1<<20 mutexes in standalone deadlock detector
...
llvm-svn: 204127
2014-03-18 08:31:11 +00:00
Dmitry Vyukov
a3b21b1d14
tsan: better addr->object hashmap
...
still experimental
llvm-svn: 204126
2014-03-18 08:30:14 +00:00
Dmitry Vyukov
24c833e1a4
tsan: add missing interceptor for embed symbolizer
...
llvm-svn: 204124
2014-03-18 08:28:39 +00:00
Kostya Serebryany
5c0171b811
[sanitizer] a bit more informative deadlock detector report (still lots to improve)
...
llvm-svn: 204115
2014-03-18 05:56:14 +00:00
Duncan P. N. Exon Smith
1373630bc4
Reapply "PGO: Statically generate data structures"
...
Reapply r204079 and r204083, this time with stubs for fputc in
compiler-rt.
llvm-svn: 204091
2014-03-17 23:44:56 +00:00
Duncan P. N. Exon Smith
ffdfaa6908
Revert r204079, r204083 and r204084 "PGO: Statically generate data structures"
...
Buildbots are having trouble finding fputc(), and I can't figure out
why. Reverting to investigate.
llvm-svn: 204088
2014-03-17 23:28:41 +00:00
Duncan P. N. Exon Smith
054f8708b5
Switch from fputc to putc to fix r204079?
...
llvm-svn: 204084
2014-03-17 22:20:58 +00:00
Duncan P. N. Exon Smith
58d2637f2a
Rename __ProfileData to __llvm_pgo_data
...
<rdar://problem/15943240>
llvm-svn: 204083
2014-03-17 22:08:05 +00:00
Duncan P. N. Exon Smith
77a88e3064
PGO: Statically generate data structures
...
In instrumentation-based profiling, we need a set of data structures to
represent the counters. Previously, these were built up during static
initialization. Now, they're shoved into a specially-named section so
that they show up as an array.
As a consequence of the reorganizing symbols, instrumentation data
structures for linkonce functions are now correctly coalesced.
This is the first step in a larger project to minimize runtime overhead
and dependencies in instrumentation-based profilng. The larger picture
includes removing all initialization overhead and making the dependency
on libc optional.
<rdar://problem/15943240>
llvm-svn: 204079
2014-03-17 21:18:24 +00:00
Kostya Serebryany
e7846206e8
[sanitizer] fix the deadlock detector build
...
llvm-svn: 204044
2014-03-17 15:16:25 +00:00
Kostya Serebryany
f01c094cdd
[sanitizer] reverse the order of the stack traces printed for every pair of locks in the deadlock report (first print the 'from' node, then print the 'to' node of the deadlock graph)
...
llvm-svn: 204043
2014-03-17 14:56:04 +00:00
Kostya Serebryany
8976539627
[sanitizer] make the deadlock detector print 2*N stack traces on lock-order-inversion with N locks (i.e. print stack traces for both lock acquisitions in every edge in the graph). More improvements to follow
...
llvm-svn: 204042
2014-03-17 14:41:36 +00:00
Kostya Serebryany
a0eb97a50b
[sanitizer] allow to store the lock context (stack trace id) with all currently held locks in a thread. This will allow the deadlock detector to provide better warnings (more changes to go)
...
llvm-svn: 204039
2014-03-17 12:27:42 +00:00
Kostya Serebryany
bd7563eee2
[tsan] fox the GO build
...
llvm-svn: 204037
2014-03-17 10:37:44 +00:00
Kostya Serebryany
b9cb473fb8
[sanitizer] fix build warnings; add an output test for the deadlock detecor
...
llvm-svn: 204035
2014-03-17 09:21:41 +00:00
Kostya Serebryany
d674e6bdde
[sanitizer] print more stack traces when reporting a deadlock (even more to come)
...
llvm-svn: 204034
2014-03-17 09:07:24 +00:00
Dmitry Vyukov
3b37e8bf18
tsan: yet another attempt to fix pthread_cond interceptors
...
Make behavior introduced in r202820 conditional (under legacy_pthread_cond flag).
The new issue that we've hit with the satellite pthread_cond_t struct is
that pthread_condattr_getpshared does not work (satellite data is not shared between processes).
The idea is that most processes do not use pthread 2.2.5.
The rare ones that use (2.2.5 is dated by 2002) must specify legacy_pthread_cond=1
on their own risk.
llvm-svn: 204032
2014-03-17 07:51:53 +00:00
Kostya Serebryany
c98564c3aa
[sanitizer] make real_pthread_attr_getstack extern "C"
...
llvm-svn: 204029
2014-03-17 05:00:35 +00:00
Alexander Potapenko
9c97e0de24
[ASan] Remove the unneeded ASAN_RUNTIME_LDFLAGS.
...
llvm-svn: 203913
2014-03-14 10:16:59 +00:00
Kostya Serebryany
8ecd7a2171
[sanitizer] fully implement racy fast path in bitset-based deadlock detector
...
llvm-svn: 203910
2014-03-14 09:22:01 +00:00
Kostya Serebryany
61a0f1c564
[sanitizer] partially implement racy fast path in bitset-based deadlock detector
...
llvm-svn: 203904
2014-03-14 08:06:15 +00:00
Kostya Serebryany
c067864b6f
[sanitizer] in bitset-based deadlock detector collect edge's stack trace when an edge is added to the graph (in following CLs these stack traces will be added to the report)
...
llvm-svn: 203902
2014-03-14 07:09:01 +00:00
Kostya Serebryany
65dbf46950
[sanitizer] in bitvector-based deadlock detector split onLock into onLockBefore and onLockAfter hooks
...
llvm-svn: 203796
2014-03-13 13:21:30 +00:00
Evgeniy Stepanov
9fa9a49853
[msan] Test for aggregates passing through ellipsis.
...
llvm-svn: 203795
2014-03-13 13:18:15 +00:00
Alexey Samsonov
13f21af177
[TSan] Hide message about re-execing under verbosity flag
...
llvm-svn: 203793
2014-03-13 13:14:19 +00:00
Timur Iskhodzhanov
28bc2f7a14
Work around PR19125: -Wconstant-logical-operand false positive
...
llvm-svn: 203782
2014-03-13 10:43:02 +00:00
Kostya Serebryany
de3f20cf4b
[sanitizer] support recursive rwlocks in bitset-based deadlock detector
...
llvm-svn: 203779
2014-03-13 10:26:03 +00:00
Timur Iskhodzhanov
5c40cc3549
Disable fast shadow zero'ing on Windows
...
llvm-svn: 203778
2014-03-13 10:15:10 +00:00
Timur Iskhodzhanov
e8bd672d31
FastPoisonShadow: check for MmapFixedNoReserve failures
...
llvm-svn: 203776
2014-03-13 10:08:45 +00:00
Alexey Samsonov
32956d651a
[CMake] Make append_if semantics similar to those used in LLVM
...
llvm-svn: 203773
2014-03-13 09:31:36 +00:00
Joerg Sonnenberger
361a553ace
Preserve constness for intermediate pointers.
...
llvm-svn: 203743
2014-03-13 00:44:37 +00:00
Justin Bogner
8b77f351a8
Revert "profile: Use a simple binary format for profiling"
...
This will break without the corresponding change in clang, which I've
reverted until I figure out how to get it to link properly.
This reverts commit r203710.
llvm-svn: 203713
2014-03-12 21:07:26 +00:00
Justin Bogner
ac7c599254
profile: Use a simple binary format for profiling
...
llvm-svn: 203710
2014-03-12 20:52:34 +00:00
Daniel Sanders
f90e78a48d
Implement Android versions of __clear_cache for arm32 & mips.
...
The MIPS version was reviewed by myself. The ARM version was reviewed by JF
Bastien.
Patch by Narayan Kamath <narayan@google.com>.
llvm-svn: 203674
2014-03-12 16:38:27 +00:00
Dmitry Vyukov
22196e777c
tsan: fix deadlock in deadlock detector
...
forget to unlock a mutex on one of the paths
llvm-svn: 203663
2014-03-12 14:55:20 +00:00
Timur Iskhodzhanov
c3687e7bf3
Fix MSVS warnings in the sanitizers RTL
...
llvm-svn: 203661
2014-03-12 14:09:25 +00:00
Viktor Kutuzov
ebb00e1553
Add FreeBSD 9.2 support to asan_linux.cc
...
llvm-svn: 203658
2014-03-12 12:44:36 +00:00
Dmitry Vyukov
8c0f86e307
tsan: fix handling of pthread_cond_wait in presence of pthread_cancel
...
if the thread is cancelled in pthread_cond_wait, it locks the mutex before
processing pthread_cleanup stack
but tsan was missing that, thus reporting false double-lock/wrong-unlock errors
see the test for details
llvm-svn: 203648
2014-03-12 09:48:14 +00:00
Dmitry Vyukov
4076b3481a
tsan: add interceptors for fopen64, freopen64, tmpfile, tmpfile64
...
llvm-svn: 203647
2014-03-12 08:26:43 +00:00
Hans Wennborg
9f74f15682
Revert "[asan] Make __cxa_demangle non-weak symbol on Android."
...
stlport doesn't include __cxa_demangle.
This reverts r201545.
llvm-svn: 203601
2014-03-11 20:23:59 +00:00
Alexander Potapenko
a0c5a6763a
[ASan] Don't build the ASan runtime with -undefined dynamic_lookup, which isn't necessary anymore.
...
Fixes https://code.google.com/p/address-sanitizer/issues/detail?id=266 .
llvm-svn: 203572
2014-03-11 14:04:09 +00:00
Evgeniy Stepanov
14cd8e900f
[sanitizer] Fix a typo.
...
llvm-svn: 203568
2014-03-11 13:35:41 +00:00
Viktor Kutuzov
f31e53661f
A fix for platform-dependent types in sanitizers' profiling support lib on x64 FreeBSD in 32-bit mode
...
llvm-svn: 203470
2014-03-10 16:50:53 +00:00
Tim Northover
65fe9377f0
ARM: fix file's header comment
...
llvm-svn: 203247
2014-03-07 14:56:29 +00:00
Alexey Samsonov
18adbc361a
Remove sanitizer_linux_libcdep.cc from TSan-Go build
...
llvm-svn: 203238
2014-03-07 13:17:32 +00:00
Alexey Samsonov
f3f3b9e5b6
[FreeBSD] Add support for sanitizer_linux_libcdep.cc
...
Patch by Viktor Kutuzov!
llvm-svn: 203235
2014-03-07 11:47:32 +00:00
Alexey Samsonov
78a6d2073f
[FreeBSD] Port sanitizers' syscalls.
...
Patch by Viktor Kutuzov!
llvm-svn: 203227
2014-03-07 10:03:54 +00:00
Dmitry Vyukov
f852f08fb1
tsan: fix pthread_cond_destroy interceptor on android
...
llvm-svn: 203226
2014-03-07 10:01:16 +00:00
Alexey Samsonov
fefeecc7b0
[ASan] Better way to disable tests for functions unavailable on certain platforms
...
llvm-svn: 203224
2014-03-07 09:39:01 +00:00
Dmitry Vyukov
dd419aee00
tsan: update Go windows build script
...
llvm-svn: 203121
2014-03-06 14:49:21 +00:00
Evgeniy Stepanov
72a9d25060
[sanitizer] Simplify interceptors with user callbacks.
...
Get rid of the context argument in UNPOISON_PARAM and INITIALIZE_RANGE.
Get rid of all the thread-local contexts in interceptors.
llvm-svn: 203119
2014-03-06 13:26:09 +00:00
Dmitry Vyukov
350e7ddd34
tsan: update interface for Go
...
this is required to fix:
https://code.google.com/p/go/issues/detail?id=7460
llvm-svn: 203116
2014-03-06 13:17:28 +00:00
Dmitry Vyukov
2516974e83
tsan: weaken concurrency guarantees in deadlock detector mutex hashmap
...
read locking on every access is too expensive
llvm-svn: 203112
2014-03-06 12:04:26 +00:00
Dmitry Vyukov
119aa0ea7c
tsan: add -ftls-model=initial-exec to deadlock detector flags
...
one way or another it must present in the process from the beginning
llvm-svn: 203111
2014-03-06 12:03:39 +00:00
Dmitry Vyukov
69bd9ca91c
tsan: better error message wording in deadlock reports
...
llvm-svn: 203109
2014-03-06 12:02:17 +00:00
Alexey Samsonov
5ec35b75ef
[FreeBSD] Provide FreeBSD-specific things for ASan.
...
Patch by Viktor Kutuzov!
llvm-svn: 203100
2014-03-06 09:05:52 +00:00
Alexey Samsonov
d52b9ba38d
[FreeBSD] Enable procmaps on FreeBSD.
...
This is not the final patch for procmaps, but it's enough for building
sanitizers and tests on FreeBSD.
Patch by Viktor Kutuzov!
llvm-svn: 203099
2014-03-06 08:58:24 +00:00
Alexey Samsonov
921f5a529e
asan_symbolize.py: use llvm-symbolizer results even if it returned function name w/o file/line info
...
llvm-svn: 202983
2014-03-05 15:18:50 +00:00
Alexey Samsonov
8ad7a05bb4
Improve llvm-symbolizer discovery in asan_symbolize.py
...
llvm-svn: 202982
2014-03-05 15:00:36 +00:00
Alexey Samsonov
e062e4c7eb
Enable memrchr interceptor only on Linux
...
llvm-svn: 202981
2014-03-05 14:07:19 +00:00
Dmitry Vyukov
792d4b1559
tsan: add missing header file to sanitizer_common cmake file
...
llvm-svn: 202979
2014-03-05 13:55:32 +00:00
Dmitry Vyukov
e73e0a04d7
tsan: fix deadlock detector build for SANITIZER_DEADLOCK_DETECTOR_VERSION=2
...
llvm-svn: 202977
2014-03-05 13:53:29 +00:00
Dmitry Vyukov
9b410fb627
tsan: implement new version of standalong deadlock detector
...
intercept pthread_cond (it is required to properly track state of mutexes)
detect cycles in mutex graph
llvm-svn: 202975
2014-03-05 13:41:21 +00:00
Dmitry Vyukov
cd3583a4c7
tsan: include what you use
...
VPrintf uses common_flags()
llvm-svn: 202974
2014-03-05 13:40:05 +00:00
Alexey Samsonov
6dece3c99f
Add common interceptors for memchr/memrchr
...
llvm-svn: 202972
2014-03-05 13:25:32 +00:00
Alexey Samsonov
c8c38dbb18
Increase threshold in StackTrace::LocatePcInTrace
...
llvm-svn: 202950
2014-03-05 08:29:56 +00:00
Dmitry Vyukov
19126f9075
tsan: add interceptors for pthread_spinlock_t and ptread_rwlock_t for deadlock detector
...
llvm-svn: 202947
2014-03-05 08:10:27 +00:00
Dmitry Vyukov
30076b0244
tsan: add another missing windows atomic operation
...
llvm-svn: 202852
2014-03-04 14:21:42 +00:00
Dmitry Vyukov
0a650fe711
tsan: attempt to fix darwin build
...
everything except linux does not need this hackery with pthread_cond
llvm-svn: 202850
2014-03-04 14:16:28 +00:00
Alexey Samsonov
359c105c92
Fix StackTrace::LocatePcInTrace, add more unit tests for generic StackTrace
...
llvm-svn: 202849
2014-03-04 14:06:11 +00:00
Alexey Samsonov
d964e7cd81
[CMake] Test for libdl and libpthread presence
...
llvm-svn: 202847
2014-03-04 13:28:21 +00:00
Alexey Samsonov
3d9adc0a73
[ASan] Speed up stack trace unwinding for stacks of size 2.
...
Summary:
We don't need to do any work in this case - just take
the current PC and caller PC.
Reviewers: eugenis, ygribov
Reviewed By: eugenis
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2936
llvm-svn: 202845
2014-03-04 13:12:25 +00:00
Dmitry Vyukov
d1d8653742
tsan: add dynamic library target for standalone deadlock detector
...
it's LD_PRELOAD-able
llvm-svn: 202843
2014-03-04 12:52:20 +00:00
Alexey Samsonov
3e8467b8b9
Avoid doing any work when unwinding stack traces with 0 or 1 frame
...
llvm-svn: 202837
2014-03-04 12:21:28 +00:00
Dmitry Vyukov
9e3a217adb
tsan: fix windows build
...
llvm-svn: 202831
2014-03-04 11:57:25 +00:00