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
Kostya Serebryany
4681fbf002
[tsan] simplify tsan-vs-gvn test since gvn vs tsan is now fixed; fix lint
...
llvm-svn: 175037
2013-02-13 06:07:50 +00:00
Richard Smith
60261eadbd
Highlight caret in bold green, to match Clang diagnostics.
...
llvm-svn: 175013
2013-02-12 22:12:10 +00:00
Evgeniy Stepanov
71a4ab7141
[sanitizer] Tests for scanf parser in allowGnuMalloc=false mode.
...
llvm-svn: 174971
2013-02-12 14:37:55 +00:00
Evgeniy Stepanov
e676f66fe3
[msan] Allow zero buf pointer in getcwd() interceptor.
...
llvm-svn: 174970
2013-02-12 14:36:22 +00:00
Evgeniy Stepanov
b5ec3a2d55
[sanitizer] More accurate scanf parsing without GNU extensions.
...
In __isoc99_*scanf we don't have to worry about GNUisms, and can parse
%a accurately.
Patch by Jakub Jelinek.
llvm-svn: 174969
2013-02-12 14:29:34 +00:00
Evgeniy Stepanov
a73704c0f8
[asan] Add new __isoc99_*scanf to ASan intercepted functions list.
...
llvm-svn: 174965
2013-02-12 12:45:29 +00:00
Evgeniy Stepanov
d8cfb99a71
[sanitizer] Missing changes from r174960.
...
llvm-svn: 174962
2013-02-12 12:02:49 +00:00
Evgeniy Stepanov
5fa8fb7d91
[sanitizer] Intercept __isoc99_*scanf.
...
llvm-svn: 174960
2013-02-12 11:34:52 +00:00
Kostya Serebryany
2659e96e4b
[asan] change the default mapping offset on x86_64 to 0x7fff8000. This gives roughly 5% speedup. Since this is an ABI change, bump the asan ABI version by renaming __asan_init to __asan_init_v1. compiler-rt part
...
llvm-svn: 174958
2013-02-12 11:11:58 +00:00
Alexey Samsonov
93686fc6f1
[MSan] symbolize correct PC when printing Summary message
...
llvm-svn: 174956
2013-02-12 10:46:39 +00:00
Evgeniy Stepanov
154faa6ded
[sanitizer] clang-format pass over scanf code.
...
llvm-svn: 174888
2013-02-11 15:22:34 +00:00
Evgeniy Stepanov
455c72d25e
[sanitizer] scanf: don't report stores that did not happen.
...
Respect REAL(scanf) return value and don't report memory stores that
could potentially happen, but did not.
llvm-svn: 174887
2013-02-11 15:16:48 +00:00
Evgeniy Stepanov
5eb25e8d39
[sanitizer] Remove an extra va_copy.
...
llvm-svn: 174883
2013-02-11 14:08:12 +00:00
Evgeniy Stepanov
7e0430fe4f
[sanitizer] Scanf parser improvements.
...
Handle %a in cases when it is unambiguous.
Handle %m.
Patch by Jakub Jelinek.
llvm-svn: 174882
2013-02-11 14:04:24 +00:00
Evgeniy Stepanov
257274e754
[msan] Lit tests for MemorySanitizer.
...
Build system setup for MSan lit tests (build with freshly-built clang, run,
check output) - a nearly exact copy from ASan.
First 2 lit tests for MSan.
llvm-svn: 174876
2013-02-11 11:34:26 +00:00
Kostya Serebryany
53e37ef74f
[tsan] added tsan-vs-gvn test
...
llvm-svn: 174875
2013-02-11 11:28:03 +00:00
Evgeniy Stepanov
9f9d79f3ad
[sanitizer] Fix line numbers in a sanitizer lit test.
...
llvm-svn: 174861
2013-02-11 07:19:24 +00:00
Evgeniy Stepanov
0b805cc75c
[asan] Fix off-by-one in AddrIsAtRight.
...
llvm-svn: 174710
2013-02-08 12:59:42 +00:00
Evgeniy Stepanov
60a8e5b9b7
[sanitizer] Fix lint.
...
llvm-svn: 174708
2013-02-08 12:13:43 +00:00
Timur Iskhodzhanov
167f9e4395
[ASan] Switch Windows to allocator v2, also fixing some build errors
...
llvm-svn: 174707
2013-02-08 12:02:00 +00:00
Timur Iskhodzhanov
659bca56a7
[ASan] Move functions using BitScan/clzl to sanitizer_common
...
llvm-svn: 174706
2013-02-08 11:45:04 +00:00
Evgeniy Stepanov
e6045b4603
[sanitizer] Add 2 random tests for the scanf implementation.
...
llvm-svn: 174705
2013-02-08 11:19:23 +00:00
Evgeniy Stepanov
87c43537df
[sanitizer] Improve scanf interceptor
...
This a rewrite of the scanf parser. The new implementation is pretty close to
the spec, with a few shortcuts taken here and there. It is conservative, i.e.
it gives up parsing if it does not understand some part of the format string,
or runs into an ambiguous % spec. It does not handle some rarely used parts of
the spec, like %n$ - for now.
I'm also moving parser call to after the original *scanf function completes,
so that we can find out the store size of %s directive by the use of strlen()
on the target buffer.
llvm-svn: 174704
2013-02-08 11:17:20 +00:00
Dmitry Vyukov
e679798315
tsan: fix suppress_java logic
...
llvm-svn: 174635
2013-02-07 17:12:28 +00:00
Alexander Potapenko
c192af29f5
[ASan] Remove the replace_cfallocator flag, which is used no more.
...
See https://code.google.com/p/address-sanitizer/issues/detail?id=10 for the context.
llvm-svn: 174629
2013-02-07 15:59:37 +00:00
Alexander Potapenko
dc91edad59
[ASan] Enable alloc_dealloc_mismatch by default on Darwin.
...
Enable AddressSanitizer.AllocDeallocMismatch tests.
llvm-svn: 174628
2013-02-07 15:55:21 +00:00
Alexander Potapenko
4fb43438d9
[ASan] Enable the new and delete wrappers on Darwin.
...
Also fix large_func_test.cc, which got broken when we switched to allocator2: the OOB access was too far from the original allocation, so ASan decided to describe the next one.
llvm-svn: 174626
2013-02-07 15:33:56 +00:00
Dmitry Vyukov
effd98b0f4
tsan: intercept libc __res_iclose
...
this is required to catch close of file descriptors created in getaddrinfo()
llvm-svn: 174624
2013-02-07 15:27:45 +00:00
Dmitry Vyukov
e94f4c048e
tsan: fix Go build
...
llvm-svn: 174622
2013-02-07 15:26:55 +00:00
Kostya Serebryany
39675fe9c8
[sanitizer] always allocate 16-byte aligned chunks of memory
...
llvm-svn: 174617
2013-02-07 15:04:06 +00:00
Alexander Potapenko
109aa04ea9
[sanitizer_common] Fix lint warnings.
...
llvm-svn: 174616
2013-02-07 14:58:04 +00:00
Alexander Potapenko
07c740e213
[ASan] Fix a compilation warning.
...
llvm-svn: 174604
2013-02-07 12:00:40 +00:00
Alexander Potapenko
f444a49310
[ASan] Implement asan_mz_size(), asan_mz_force_lock() and asan_mz_force_unlock() for allocator2.
...
Switch to allocator2 on Darwin.
llvm-svn: 174603
2013-02-07 11:40:03 +00:00
Evgeniy Stepanov
4ea6816247
[sanitizer] OFF_T on Mac is u64.
...
llvm-svn: 174600
2013-02-07 09:52:43 +00:00
Kostya Serebryany
df2f0bff37
[tsan] race_on_write test
...
llvm-svn: 174599
2013-02-07 09:48:17 +00:00
Evgeniy Stepanov
44f083d49b
[sanitizer] Exclude off64_t test on mac.
...
llvm-svn: 174598
2013-02-07 09:34:08 +00:00
Alexey Samsonov
b788512d11
[Sanitizer] include stddef.h for ptrdiff_t in interception type test
...
llvm-svn: 174597
2013-02-07 09:03:01 +00:00
Zonr Chang
2d5d8168ff
Implement aeabi_{f,d}cmp*.
...
Special thanks to Anton for the review.
llvm-svn: 174596
2013-02-07 08:29:47 +00:00
Kostya Serebryany
7b0b9b3b65
[msan] add strip_path_prefix flag; print error summary; don't crash while printing summary if debug info is missing. The tests will follow later once we establish the lit-like tests for msan.
...
llvm-svn: 174595
2013-02-07 08:04:56 +00:00
Evgeniy Stepanov
3e3d0be7de
[sanitizer] Add a missing header.
...
llvm-svn: 174594
2013-02-07 07:43:41 +00:00
Evgeniy Stepanov
8268785f44
[sanitizer] Fix wrong size of OFF_T on 32-bit platforms.
...
This broke pread/pwrite interceptors when building without
-D_FILE_OFFSET_BITS=64, and always on Android.
llvm-svn: 174593
2013-02-07 07:37:12 +00:00
Alexey Samsonov
85cc9b655d
[TSan] skip multiple internal frames, if necessary
...
llvm-svn: 174516
2013-02-06 16:28:05 +00:00
Alexander Potapenko
09aba10499
[ASan] fix the interceptor for siglongjmp. As we're using dylib interposition, we must intercept both siglongjmp and longjmp on Darwin.
...
llvm-svn: 174510
2013-02-06 15:45:43 +00:00
Alexander Potapenko
d895ae94f9
Use 64-bit inodes in file operations. ASan is now built with -mmacosx-version-min=10.5, thus the default inode
...
size is 32 bits. However the supported client code is going to target 10.6 and higher, where 64-bit inodes will be used.
llvm-svn: 174507
2013-02-06 14:41:15 +00:00
Kostya Serebryany
21bedab7a1
[tsan] improve FrameIsInternal
...
llvm-svn: 174506
2013-02-06 14:32:16 +00:00
Kostya Serebryany
4fb340d972
[tsan] print error summary line
...
llvm-svn: 174505
2013-02-06 14:24:00 +00:00
Kostya Serebryany
b4c2c5c8a6
[asan] print a short one-line report summary after the full report. Currently, works only if symbolization happens in-process.
...
llvm-svn: 174501
2013-02-06 12:36:49 +00:00
Alexander Potapenko
34157fc33f
[ASan] Delete the code related to static runtime on OS X.
...
Nuke lib/interception/mach_override.
llvm-svn: 174383
2013-02-05 15:57:12 +00:00
Evgeniy Stepanov
36017454ac
[asan] Fix Win/Mac build.
...
llvm-svn: 174376
2013-02-05 15:02:12 +00:00
Evgeniy Stepanov
1bc7298c44
[asan] Fix nonsensical reports of partial right OOB.
...
In case of partial right OOB, ASan was reporting
X is located 0 bytes to the right of [A, B)
where X was actually inside [A, B).
With this change, ASan will report B as the error address in such case.
llvm-svn: 174373
2013-02-05 14:32:03 +00:00
Dmitry Vyukov
fa67ed47e1
asan/tsan: fix failing CHECK on windows
...
llvm-svn: 174319
2013-02-04 10:42:38 +00:00
Alexey Samsonov
576e270287
[Sanitizer] use proper casting in *stat functions on Mac
...
llvm-svn: 174318
2013-02-04 10:31:39 +00:00
Alexey Samsonov
2c5cbd2b38
[Sanitizer] extend internal libc with stat/fstat/lstat functions
...
llvm-svn: 174316
2013-02-04 10:16:50 +00:00
Dmitry Vyukov
7981ea8baa
asan/tsan: fix compilation errors/bugs on Windows where long is 32-bit even in 64-bit mode
...
llvm-svn: 174312
2013-02-04 08:07:45 +00:00
Dmitry Vyukov
606de60163
tsan: intercept bind/listen
...
llvm-svn: 174311
2013-02-04 08:06:32 +00:00
Alexey Samsonov
4985b8766e
[Sanitizer] use u32 instead of mode_t, which is defined in Darwin headers
...
llvm-svn: 174189
2013-02-01 16:32:18 +00:00
Alexey Samsonov
2e50809961
[ASan] remove debug output from the test
...
llvm-svn: 174188
2013-02-01 16:06:25 +00:00
Alexey Samsonov
39313b780d
[Sanitizer] make internal_open have the same interface as libc version
...
llvm-svn: 174187
2013-02-01 15:58:46 +00:00
Dmitry Vyukov
1fab680c1b
tsan: catch races on fd in more cases
...
llvm-svn: 174184
2013-02-01 15:52:35 +00:00
Alexey Samsonov
84cf6a4333
[TSan] remove artifacts from gotsan build in 'make clean' command
...
llvm-svn: 174180
2013-02-01 15:30:36 +00:00
Dmitry Vyukov
87c6bb9716
tsan: even if races between atomic and plain memory accesses are turned off (report_atomic_races=0),
...
still report races between atomic accesses and free().
llvm-svn: 174175
2013-02-01 14:41:58 +00:00
Dmitry Vyukov
628df38e95
tsan: say that the memory access is atomic in reports
...
llvm-svn: 174168
2013-02-01 11:10:53 +00:00
Dmitry Vyukov
aa6af4ddd1
tsan: remember 2 stack frames for atomics (caller and atomic itself)
...
llvm-svn: 174167
2013-02-01 11:01:17 +00:00
Dmitry Vyukov
52f0e4e1a0
tsan: add flag to not report races between atomic and plain memory accesses
...
llvm-svn: 174165
2013-02-01 10:06:56 +00:00
Dmitry Vyukov
71242b064e
tsan: flip is_write bit in shadow to is_read
...
this makes calculation of interesting predicates faster
llvm-svn: 174164
2013-02-01 10:02:55 +00:00
Dmitry Vyukov
ba4291480d
tsan: detect races between plain and atomic memory accesses
...
llvm-svn: 174163
2013-02-01 09:42:06 +00:00
Kostya Serebryany
bda64b4d40
[sanitizer] make the error messages from sanitizer_common contain the actual tool name
...
llvm-svn: 174059
2013-01-31 14:11:21 +00:00
Alexey Samsonov
a0c0da8f51
[ASan] Split ASan interface header into private and public parts. Add a test that makes sure users can include interface header
...
llvm-svn: 174058
2013-01-31 13:46:14 +00:00
Dmitry Vyukov
6f4a6ab5d6
tsan: switch to explicit thread contexts in Go (instead of monotonic goroutine ids)
...
llvm-svn: 174047
2013-01-31 07:48:43 +00:00
Dmitry Vyukov
6095285d0b
tsan: do not check for intersecting memory accesses in Go (all accesses are 1 byte)
...
llvm-svn: 174046
2013-01-31 07:47:58 +00:00
Dmitry Vyukov
00e0236665
asan/tsan: manually define FUTEX constants, because <linux/futes.h> header is broken on some linux distributions
...
llvm-svn: 173933
2013-01-30 14:39:27 +00:00
Dmitry Vyukov
087efd23d6
tsan: fix CPP_WEAK definition (it must be the other way around)
...
llvm-svn: 173932
2013-01-30 14:38:44 +00:00
Alexey Samsonov
32832e6176
[Sanitizer] include sanitizer_common headers when building interception library
...
llvm-svn: 173930
2013-01-30 14:27:41 +00:00
Alexey Samsonov
c500132a93
[Sanitizer] Add change missed in r173926
...
llvm-svn: 173929
2013-01-30 13:19:15 +00:00
Evgeniy Stepanov
358698279d
[sanitizer] Further split private and public sanitizer headers.
...
And make msan_interface.h C-compatible.
llvm-svn: 173928
2013-01-30 13:12:08 +00:00
Alexey Samsonov
0d92533b29
Use LLVM_BUILD_TYPE instead of CMAKE_BUILD_TYPE in compiler-rt unit tests to match the behavior of llvm unittests
...
llvm-svn: 173926
2013-01-30 12:18:49 +00:00
Dmitry Vyukov
d6b9348bf3
tsan: introduce a helped macro CPP_WEAK (Go linker does not support weak symbols)
...
llvm-svn: 173917
2013-01-30 09:46:53 +00:00
Dmitry Vyukov
5fbfafcd8c
tsan: add OnFinalize() callback for frontends
...
llvm-svn: 173915
2013-01-30 09:24:00 +00:00
Alexey Samsonov
a1eb11f915
[TSan] relax output tests a bit to make them pass in gcc build
...
llvm-svn: 173913
2013-01-30 08:41:57 +00:00
Alexey Samsonov
49a32c1d08
[Sanitizer] update style checker script and fix namespace style warnings
...
llvm-svn: 173910
2013-01-30 07:45:58 +00:00
Will Dietz
25abfe49e1
[tsan] Fix checks for siginfo_t in tests
...
llvm-svn: 173815
2013-01-29 18:29:34 +00:00
Evgeniy Stepanov
eac7f934f0
[msan] Cleanup public interface header.
...
Moved everything users are not supposed to use to a private interface header.
Documented all public interfaces. Made them safe to use even if built without
MemorySanitizer.
llvm-svn: 173800
2013-01-29 14:33:29 +00:00
Dmitry Vyukov
019ef67a97
tsan: dump stack on internal assert failure
...
llvm-svn: 173799
2013-01-29 14:20:12 +00:00
Dmitry Vyukov
4399d92252
tsan: support for inprocess symbolizer
...
llvm-svn: 173797
2013-01-29 13:05:30 +00:00
Dmitry Vyukov
b46930befa
tsan: remember when we are inside of symbolizer code (required for inprocess symbolizer)
...
llvm-svn: 173796
2013-01-29 13:03:07 +00:00
Alexey Samsonov
322d7fbd9d
ASan: fix lint
...
llvm-svn: 173795
2013-01-29 12:08:12 +00:00
Dmitry Vyukov
73b12d7132
asan: fix the test
...
llvm-svn: 173786
2013-01-29 09:59:53 +00:00
Dmitry Vyukov
0632dd410c
tsan: fix the message (tsan is not asan)
...
llvm-svn: 173784
2013-01-29 09:39:58 +00:00
Dmitry Vyukov
7943b69002
tsan: add IsSymbolizerAvailable() function for querying for presence of internal/external symbolizer
...
llvm-svn: 173783
2013-01-29 09:35:14 +00:00
Dmitry Vyukov
b130fc3c0d
tsan: add interceptor stubs for stat family of functions
...
llvm-svn: 173782
2013-01-29 09:23:09 +00:00
Alexey Samsonov
9aa2e4f5c4
[ASan] fix deallocation hook in allocator2: according to specification, dealloc hook should be called before deallocating memory
...
llvm-svn: 173778
2013-01-29 08:19:11 +00:00
Alexey Samsonov
615b86cf0a
[ASan] Do allocate memory even for zero-size allocation requests. Explain why we have to do this in comments.
...
llvm-svn: 173776
2013-01-29 07:51:34 +00:00
Timur Iskhodzhanov
6cff9deb16
Use the correct order of NOINLINE vs ret type to fix Windows build
...
llvm-svn: 173694
2013-01-28 17:29:50 +00:00
Evgeniy Stepanov
9f7e8c1433
[msan] A runtime call to support custom allocators.
...
llvm-svn: 173687
2013-01-28 13:52:49 +00:00
Evgeniy Stepanov
2538bd1901
[msan] Remove icmp tests that require exact shadow propagation.
...
llvm-svn: 173686
2013-01-28 13:45:16 +00:00
Alexey Samsonov
7eda134fa7
[ASan] fix a bug in allocator-v2 which could lead to SEGV on realloc(malloc(0), 4)
...
llvm-svn: 173681
2013-01-28 11:24:13 +00:00
Kostya Serebryany
61761f182b
[asan] fix a crash in asan stats printing (initialize the allocator in __asan_init)
...
llvm-svn: 173676
2013-01-28 08:05:47 +00:00
Kostya Serebryany
6c17547ef1
[asan] two more internal flags for asan-rt: print_stats (0) and print_legend (1)
...
llvm-svn: 173671
2013-01-28 07:34:22 +00:00
Alexey Samsonov
5311754b62
[CMake] Fix compiler-rt tests after r173617
...
llvm-svn: 173668
2013-01-28 07:16:22 +00:00
Evgeniy Stepanov
0e5becb830
[msan] Tests for ICmp handling.
...
llvm-svn: 173456
2013-01-25 15:39:11 +00:00
Alexey Samsonov
622a7b2408
[Sanitizer] More fixes to scanf interceptor: stub support for %s, support for %[...] directive
...
llvm-svn: 173451
2013-01-25 15:26:19 +00:00
Kostya Serebryany
c1056f90ae
[sanitizer] improve the calloc overflow check (spotted by samsonov@)
...
llvm-svn: 173443
2013-01-25 12:22:21 +00:00
Kostya Serebryany
fa79cd65e2
[sanitizer] fix calloc overflow in asan/tsan/msan
...
llvm-svn: 173441
2013-01-25 11:46:22 +00:00
Alexey Samsonov
4899fb5cfb
[Sanitizer] fix errors in scanf interceptors: add support for %c and fix cases like %5d
...
llvm-svn: 173440
2013-01-25 11:43:32 +00:00
Dmitry Vyukov
4e3b9802bd
tsan: return the old fake numbers from malloc stats (some code already depends on them)
...
llvm-svn: 173348
2013-01-24 14:07:19 +00:00
Alexey Samsonov
971b0cd26f
[Sanitizer] use stub InternalSymbolizer on platforms where we don't have weak hooks
...
llvm-svn: 173347
2013-01-24 14:01:59 +00:00
Dmitry Vyukov
f4f76b1c10
tsan: suppress reports using both stacks
...
llvm-svn: 173346
2013-01-24 13:50:32 +00:00
Dmitry Vyukov
83566dadaf
tsan: allow a front-end to provide default suppressions
...
llvm-svn: 173345
2013-01-24 13:50:10 +00:00
Alexey Samsonov
8db4077583
[Sanitizer] Add skeleton for InternalSymbolizer that can be used by providing callbacks __sanitizer_symbolize_{code,data}
...
llvm-svn: 173344
2013-01-24 13:42:45 +00:00
Kostya Serebryany
35fb1167b0
[asan] run-time tests for adaptive redzones
...
llvm-svn: 173336
2013-01-24 10:36:11 +00:00
Alexander Potapenko
56a3724cf1
[ASan] fix compilation on Mac by adding a missing pwrite parameter.
...
llvm-svn: 173333
2013-01-24 09:15:08 +00:00
Dmitry Vyukov
6e406cda4b
tsan: implement malloc stats querying
...
llvm-svn: 173332
2013-01-24 09:08:03 +00:00
Dmitry Vyukov
0ced85a8c7
asan/tsan: fix pwrite interceptors
...
llvm-svn: 173328
2013-01-24 07:44:21 +00:00
Dmitry Vyukov
e9a44974d4
tsan: also test asan during presubmit checks, because sanitizer_common changes can affect it
...
llvm-svn: 173327
2013-01-24 07:43:55 +00:00
Evgeniy Stepanov
d1bfdc32b2
[msan] Allow waitpid while in __msan_init().
...
This is used in symbolizer init.
llvm-svn: 173263
2013-01-23 14:22:05 +00:00
Kostya Serebryany
7206a145dd
[sanitizer] increase the minimal mmap size in allocator to 2^16; fix the asan Mac build
...
llvm-svn: 173261
2013-01-23 14:07:17 +00:00
Kostya Serebryany
8f267137c2
[asan] initialize kHighMemEnd at startup (instead of at compile time) to simplify further changes for various address space layouts. Fix asan_allocator2 for PowerPC (tested on 44-bit address space)
...
llvm-svn: 173260
2013-01-23 13:27:43 +00:00
Dmitry Vyukov
228921d71e
tsan: add stubs for malloc introspection (similar to what we have in asan)
...
llvm-svn: 173255
2013-01-23 12:08:03 +00:00
Dmitry Vyukov
5787924e85
tsan: add missing interceptors
...
llvm-svn: 173253
2013-01-23 11:52:19 +00:00
Kostya Serebryany
7d2e4c0389
[asan] simplify the code that poisons global redzones, add some more tests
...
llvm-svn: 173251
2013-01-23 11:14:21 +00:00
Evgeniy Stepanov
ffffbefa43
[msan] gethostbyname interceptor.
...
llvm-svn: 173249
2013-01-23 10:43:38 +00:00
Evgeniy Stepanov
fdf3fa69c2
[msan] Remove the trap handler code.
...
llvm-svn: 173161
2013-01-22 14:29:15 +00:00
Evgeniy Stepanov
03ee782bee
[msan] Follow -msan-keep-going in reports from interceptors.
...
llvm-svn: 173158
2013-01-22 13:35:45 +00:00
Evgeniy Stepanov
8fdf7d0586
[msan] Fix linkage type of __msan_track_origins.
...
llvm-svn: 173157
2013-01-22 13:34:57 +00:00
Evgeniy Stepanov
f9a7aba34a
[msan] Simplify test code.
...
llvm-svn: 173155
2013-01-22 12:33:11 +00:00
Evgeniy Stepanov
2b65c0d1cf
[msan] Test handling of volatile bitfields.
...
llvm-svn: 173154
2013-01-22 12:31:39 +00:00
Evgeniy Stepanov
ef68259d26
[msan] Stop using volatile assignments as undef checks in MSan tests.
...
A runtime call is used instead.
MSan will stop adding shadow checks on volatile stores soon.
llvm-svn: 173152
2013-01-22 12:29:00 +00:00
Alexander Potapenko
81f0b331dc
[ASan] Disable the new/delete implementations for OSX
...
See https://code.google.com/p/address-sanitizer/issues/detail?id=131
llvm-svn: 173149
2013-01-22 11:39:28 +00:00
Alexey Samsonov
1e63b08575
ASan: add output test for -fsanitize-address-zero-based-shadow option on Linux
...
llvm-svn: 173146
2013-01-22 10:45:20 +00:00
Alexander Potapenko
dc00c44d46
[ASan] Remove the declarations of pthread_workqueue_t and pthread_workitem_handle_t, which are used no more.
...
Kudos to Jeremy Huddleston Sequoia <jeremyhu@apple.com>
llvm-svn: 173143
2013-01-22 10:32:06 +00:00
Alexey Samsonov
d7b901d581
ASan: use Clang -fsanitize-blacklist flag in unit tests (instead of -mllvm)
...
llvm-svn: 173142
2013-01-22 10:30:17 +00:00
Alexander Potapenko
0c92557fcb
[ASan] Fix the path to ASan interface in interface_symbols_linux.c
...
llvm-svn: 173140
2013-01-22 10:13:37 +00:00
Alexander Potapenko
5ef0f677ae
[ASan] Moved interface_symbols.c to lit_tests/Linux.
...
We already have Darwin-specific version of this test.
llvm-svn: 173136
2013-01-22 09:22:10 +00:00
Alexander Potapenko
cae42d23a6
[ASan] Use dylib interposition to hook memory allocation in the dynamic runtime.
...
This CL drastically simplifies the way we're hooking the memory allocation routines in ASan on Mac by using dylib interposition to replace the main malloc_zone_* functions. This allows us to avoid replacing the default CFAllocator and drop the CF dependency at all.
Committing this patch will result in the static runtime being broken. A follow-up CL will switch ASan to use the dynamic runtime library.
llvm-svn: 173134
2013-01-22 09:14:54 +00:00
Alexey Samsonov
a168f30073
ASan: simplify build rules for unit tests
...
llvm-svn: 173133
2013-01-22 07:31:28 +00:00
Alexey Samsonov
2f20275730
ASan: disable flexible mapping and offset on Android. It doesn't work for dynamic ASan runtime there
...
llvm-svn: 173132
2013-01-22 07:21:24 +00:00
Kostya Serebryany
56fc958506
[asan] split asan_test.cc even more
...
llvm-svn: 173131
2013-01-22 07:01:47 +00:00
Kostya Serebryany
81e916893d
[asan] split asan_test.cc more
...
llvm-svn: 173130
2013-01-22 06:50:42 +00:00
Kostya Serebryany
4184b64094
[asan] split asan_test.cc to speedup parallel build (most important if building with a debug clang, which takes a couple of minutes on this large file with templates). More splits to follow
...
llvm-svn: 173129
2013-01-22 06:39:20 +00:00
Kostya Serebryany
031b69d8df
[asan] fix linux build
...
llvm-svn: 173049
2013-01-21 15:04:36 +00:00
Alexander Potapenko
c21aa5cb39
[ASan] Move Mac-specific tests to asan_mac_test.cc
...
llvm-svn: 173048
2013-01-21 14:49:55 +00:00
Alexey Samsonov
b670018c9f
CMake: generalize checking for target availability and add initial support for PowerPC native arch. With this patch, building LLVM on PowerPC native arch produces a working ASan runtime.
...
llvm-svn: 173044
2013-01-21 14:31:45 +00:00
Evgeniy Stepanov
5f37c82154
[sanitizer] Disable scanf interceptor on windows.
...
llvm-svn: 173037
2013-01-21 13:30:08 +00:00
Alexey Samsonov
362286f34c
Fixup for r173021: build tests with zero-based shadow on Android only, fix condition in checking for shadow gap in asan_mapping.h
...
llvm-svn: 173026
2013-01-21 11:36:38 +00:00
Evgeniy Stepanov
5e7936f646
[sanitizer] Define va_copy on win32.
...
llvm-svn: 173025
2013-01-21 11:32:50 +00:00
Kostya Serebryany
9b46312c87
[tsan] fix thread_name.cc test to work with older versions of libc
...
llvm-svn: 173023
2013-01-21 11:20:49 +00:00
Alexey Samsonov
6ad1d7809d
ASan: build unit tests with -fsanitize-address-zero-base-shadow on Linux and Android
...
llvm-svn: 173021
2013-01-21 10:51:18 +00:00
Evgeniy Stepanov
f940b2e381
[asan] Move *scanf declarations out of mac-only section.
...
llvm-svn: 173020
2013-01-21 10:33:14 +00:00
Alexey Samsonov
a58bcf70a1
ASan: use dynamic lookup when building dynamic ASan runtime on Mac, because shadow mapping and offset are defined in the instrumented modules instead of runtime
...
llvm-svn: 173015
2013-01-21 09:07:01 +00:00
Alexey Samsonov
b52d1a56f0
ASan: build runtime library with ASAN_FLEXIBLE_MAPPING_AND_OFFSET=1 as shadow mapping/offset are always emitted by the LLVM backend now
...
llvm-svn: 173013
2013-01-21 08:24:19 +00:00
Alexey Samsonov
b399118cad
CMake: add functions creating universal runtime libraries for several architectures on OS X and use them in ASan and UBSan build rules
...
llvm-svn: 173011
2013-01-21 08:12:20 +00:00
Alexey Samsonov
4e50333684
CMake: Add add_compiler_rt_osx_object_library to create universal libraries on Mac
...
llvm-svn: 172979
2013-01-20 14:36:12 +00:00
Alexey Samsonov
d0522c73b5
CMake: use add_compiler_rt_static_runtime to build TSan and MSan runtimes. No functionality change.
...
llvm-svn: 172978
2013-01-20 14:14:13 +00:00
Alexey Samsonov
8c2cd862b6
CMake: Add add_compiler_rt_static_runtime function and use it to build generic compiler-rt libraries
...
llvm-svn: 172977
2013-01-20 13:58:10 +00:00
Alexey Samsonov
3292fde911
Temporary disable test added in r172828 as it seems to be flaky on the buildbots
...
llvm-svn: 172976
2013-01-20 13:41:26 +00:00
Alexey Samsonov
2d04812a45
Fixup for r172828: use InternalScopedBuffer in favor of large stack buffers
...
llvm-svn: 172975
2013-01-20 13:22:06 +00:00
Alexey Samsonov
67c8e14760
Fix a typo from r172289
...
llvm-svn: 172830
2013-01-18 17:03:47 +00:00
Alexey Samsonov
b068483d4d
CMake: Generalize build rules for different arches for sanitizer_common, asan, ubsan
...
llvm-svn: 172829
2013-01-18 16:51:07 +00:00
Alexander Potapenko
b4ba995366
[ASan] Fix the log_path option to use different log files for parent and child processes after fork().
...
llvm-svn: 172828
2013-01-18 16:44:27 +00:00
Evgeniy Stepanov
8a3666f63c
[sanitizer] Workaround broken mktemp on certain platforms.
...
llvm-svn: 172827
2013-01-18 16:24:50 +00:00
Alexey Samsonov
163ab9d0a5
CMake: create AddCompilerRT module and implement convenience add_compiler_rt_object_library function
...
llvm-svn: 172826
2013-01-18 16:05:21 +00:00
Evgeniy Stepanov
c8cde8d736
[sanitizer] Enable cpplint for .inc files.
...
llvm-svn: 172825
2013-01-18 15:53:43 +00:00
Evgeniy Stepanov
01671c33ff
[sanitizer] lint
...
llvm-svn: 172817
2013-01-18 13:12:56 +00:00
Kostya Serebryany
84c7e47b5c
[asan] kill some dead code
...
llvm-svn: 172815
2013-01-18 13:01:44 +00:00
Evgeniy Stepanov
a6c4a387ee
[sanitizer] Rename 2 files *.h->*.inc as appropriate.
...
Also add a missing include.
llvm-svn: 172814
2013-01-18 13:01:18 +00:00
Alexey Samsonov
193b45f4fe
CMake variables renaming: X86_64->x86_64 I386->i386
...
llvm-svn: 172812
2013-01-18 12:45:44 +00:00
Evgeniy Stepanov
518a135ffe
[sanitizer] Remove an unused variable.
...
llvm-svn: 172811
2013-01-18 12:32:02 +00:00
Alexander Potapenko
a6d40f638e
[ASan] Fix compilation on Mac.
...
llvm-svn: 172810
2013-01-18 12:31:16 +00:00
Evgeniy Stepanov
91181eaa59
[sanitizer] Fix Mac build.
...
llvm-svn: 172809
2013-01-18 11:38:23 +00:00
Kostya Serebryany
63c36bbe5e
[asan] fix two off-by-one errors that seem to affect only PowerPC because only there the stack top may be equal to the address space top. Noted by Andreas Schwab in http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55975#c11 . Also make swapcontext interceptor a bit more robust
...
llvm-svn: 172807
2013-01-18 11:30:36 +00:00
Evgeniy Stepanov
222076e972
[sanitizer] Common *scanf interceptors.
...
llvm-svn: 172805
2013-01-18 11:17:23 +00:00
Alexander Potapenko
51794a390f
Remove references to pthread_workqueue_additem_np(), which isn't in the official libdispatch API.
...
llvm-svn: 172802
2013-01-18 10:27:31 +00:00
Alexey Samsonov
9585613334
[ASan] fixes for Android build
...
llvm-svn: 172800
2013-01-18 09:20:06 +00:00
Kostya Serebryany
69fe0ba415
[sanitizer] reapply r172719, r172721-172723, r172725, and also fix the warning on Mac.
...
llvm-svn: 172791
2013-01-18 06:43:13 +00:00
Jakob Stoklund Olesen
7956e0094d
Revert r172719, r172721-172723, and r172725.
...
The r172719 patch broke the build on Mac, the others depended on it.
compiler-rt/lib/asan/asan_interceptors.cc:78:13: error: unused function
'SetThreadName' [-Werror,-Wunused-function]
static void SetThreadName(const char *name) {
Orignal headlines:
[asan] attempting to fix the Mac build
[asan] restructure read/pread/pread64 tests
[sanitizer] move write/pwrite/pwrite64 interceptors to common
[msan] start using common interceptors in msan
[tsan] move prctl interceptor from asan to common_interceptors thus enabling it for tsan too
llvm-svn: 172763
2013-01-17 22:51:56 +00:00
Peter Collingbourne
6600516a58
Have ReExec read environment from /proc/self/environ
...
It is possible for ReExec to be called before the C standard library
has initialised itself sufficiently for execv to work properly.
Fix this by parsing the environment ourselves and using execve.
Differential Revision: http://llvm-reviews.chandlerc.com/D304
llvm-svn: 172748
2013-01-17 19:50:42 +00:00
Will Dietz
149d952e86
[ubsan] Add SANITIZER_INTERFACE_ATTRIBUTE to __ubsan_vptr_type_cache
...
Missed this one previously.
llvm-svn: 172730
2013-01-17 17:14:12 +00:00
Alexey Samsonov
4f1885a109
[ASan] minor changes to swapcontext handling: don't clear shadow memory if context stack is too large
...
llvm-svn: 172727
2013-01-17 15:45:28 +00:00
Alexey Samsonov
708442294e
ASan: Allow __asan_get_allocated_size(malloc(0)) to be 0 or 1
...
llvm-svn: 172726
2013-01-17 15:26:47 +00:00
Kostya Serebryany
87eb229241
[asan] attempting to fix the Mac build
...
llvm-svn: 172725
2013-01-17 15:14:20 +00:00
Kostya Serebryany
709d0dac81
[asan] restructure read/pread/pread64 tests
...
llvm-svn: 172723
2013-01-17 14:58:29 +00:00
Kostya Serebryany
5cdd91fc43
[sanitizer] move write/pwrite/pwrite64 interceptors to common
...
llvm-svn: 172722
2013-01-17 14:48:03 +00:00
Kostya Serebryany
b114d01849
[msan] start using common interceptors in msan
...
llvm-svn: 172721
2013-01-17 13:57:07 +00:00
Evgeniy Stepanov
e3a325197a
[msan] More interceptors.
...
strtod and friends, dladdr, getrusage
llvm-svn: 172720
2013-01-17 13:42:17 +00:00
Kostya Serebryany
f7f5566055
[tsan] move prctl interceptor from asan to common_interceptors thus enabling it for tsan too
...
llvm-svn: 172719
2013-01-17 13:38:16 +00:00
Alexey Samsonov
769af07372
[ASan] fix __asan_get_ownership(p) and __asan_get_allocated_size(p) for the p = malloc(0)
...
llvm-svn: 172717
2013-01-17 13:25:17 +00:00
Kostya Serebryany
125e26d49b
[tsan] add write_range/read_range hooks to common interceptors called from tsan (to find races on read/pread/etc)
...
llvm-svn: 172714
2013-01-17 13:18:40 +00:00
Kostya Serebryany
93ebdb5d64
[sanitizer] a bit more unification for interceptors (merge read/pread/pread64 in asan and tsan)
...
llvm-svn: 172713
2013-01-17 13:09:00 +00:00
Dmitry Vyukov
59e5d358db
tsan: fix a bug
...
llvm-svn: 172712
2013-01-17 12:59:10 +00:00
Dmitry Vyukov
e528f67c14
tsan: fix a bug
...
llvm-svn: 172710
2013-01-17 12:13:03 +00:00
Dmitry Vyukov
7f4603200f
asan: fix ARM build
...
llvm-svn: 172613
2013-01-16 14:35:13 +00:00
Kostya Serebryany
b7062cec53
[asan] asan_allocator2: fix the memalign handling (clear the first word of allocated chunk in case there is an old memalign magic)
...
llvm-svn: 172603
2013-01-16 09:12:14 +00:00
Kostya Serebryany
d8b1f78296
[asan] enable asan_allocator2 by default on Linux. Will enable it on other platforms and remove the old one later, after additional testing. The new allocator is much faster and uses less memory
...
llvm-svn: 172531
2013-01-15 13:57:39 +00:00
Dmitry Vyukov
9ab63f68fc
asan: fix standalone malloc implementation
...
llvm-svn: 172529
2013-01-15 12:57:02 +00:00
Dmitry Vyukov
0d46b2b95e
asan: fix the constant for new allocator cache
...
llvm-svn: 172526
2013-01-15 10:45:18 +00:00
Kostya Serebryany
c4bb752e3b
[sanitizer] hide PR_SET_NAME under an ifdef (for older kernels)
...
llvm-svn: 172523
2013-01-15 09:03:23 +00:00
Dmitry Vyukov
2854326db6
asan: correct non-temporal prefetch for memory allocator
...
llvm-svn: 172522
2013-01-15 09:03:20 +00:00
Dmitry Vyukov
45a698eb58
asan: faster thead-local cache for memory allocator
...
llvm-svn: 172521
2013-01-15 09:02:20 +00:00
Dmitry Vyukov
1f48c1a9a1
asan: fix lint warnings
...
llvm-svn: 172520
2013-01-15 08:51:10 +00:00
Dmitry Vyukov
74764617d7
asan: fix bugs in the testlib
...
llvm-svn: 172519
2013-01-15 08:33:41 +00:00
Dmitry Vyukov
1e4b54d196
asan: rename the file (it's not 64-bit specific anymore)
...
llvm-svn: 172518
2013-01-15 08:04:27 +00:00
Will Dietz
9d3209b5c7
[ubsan] Use __sanitizer::atomic_exchange(), prefer shared impl.
...
Specify weaker memory order in case we optimize for it in the future,
presently still doing same __sync_lock_test_and_set() as before.
Change suggested by Alexey Samsonov, thanks!
llvm-svn: 172429
2013-01-14 16:13:52 +00:00
Evgeniy Stepanov
99d91289b6
Move large part of asan_test_utils.h to sanitizer_common.
...
Move my_rand() to the common header.
This lets us avoid the use of rand_r in sanitizer_common tests.
There is no rand_r on Android.
llvm-svn: 172421
2013-01-14 15:12:26 +00:00
Alexey Samsonov
4e958e5ddb
Fix-up copypasto from r172410
...
llvm-svn: 172419
2013-01-14 14:52:35 +00:00
Dmitry Vyukov
ff19809a3d
asan: fix windows build
...
llvm-svn: 172415
2013-01-14 14:28:06 +00:00
Evgeniy Stepanov
cfe3b3b956
Build rules for sanitizer_common tests on Android.
...
llvm-svn: 172410
2013-01-14 14:08:25 +00:00
Evgeniy Stepanov
e375a1f036
Remove thread-locals from sanitizer_common tests.
...
Not supported on Android.
llvm-svn: 172408
2013-01-14 14:06:58 +00:00
Alexey Samsonov
66b35642d4
ASan: Disable alloc/dealloc mismatch test on Android. It's not supposed to work there
...
llvm-svn: 172398
2013-01-14 11:07:59 +00:00
Kostya Serebryany
b05fc3a493
[asan] use the slow CFI-based unwinder when reporting an error. Still use the fast unwinder for malloc/free. Linux-x86-only for now.
...
llvm-svn: 172397
2013-01-14 11:01:34 +00:00
Dmitry Vyukov
4ebb4e5565
asan/tsan: mmap shadow memory before allocating memory (otherwise other threads can access non yet allocated shadow)
...
llvm-svn: 172395
2013-01-14 10:49:11 +00:00
Alexey Samsonov
aaa50f06d4
ASan: Disable alloc/dealloc-mismatch checker on Mac for now (it produces weird false positives on googletest)
...
llvm-svn: 172394
2013-01-14 10:18:38 +00:00
Dmitry Vyukov
c1a1517a37
tsan: describe stack and TLS addresses
...
llvm-svn: 172393
2013-01-14 10:00:03 +00:00
Dmitry Vyukov
9de857a0be
asan: enable allocator version 1 by default
...
llvm-svn: 172392
2013-01-14 09:03:24 +00:00
Dmitry Vyukov
38092f628b
asan/tsan: fix memory allocator statistics
...
llvm-svn: 172390
2013-01-14 08:51:08 +00:00
Dmitry Vyukov
064c739cea
asan: fix Android build
...
llvm-svn: 172389
2013-01-14 08:48:26 +00:00
Dmitry Vyukov
795eb90db5
asan/tsan: faster memory allocator
...
1. Increase size classes from 32k to 128k
2. Use lock-free stack in central cache
3. Use blocking mutex when allocate new memory with mmap
llvm-svn: 172388
2013-01-14 08:23:34 +00:00
Dmitry Vyukov
8d15db4a1e
tsan: fix cmake warning (unused private field)
...
llvm-svn: 172387
2013-01-14 08:21:34 +00:00
Dmitry Vyukov
316faf78ee
tsan: add the FIXME
...
llvm-svn: 172386
2013-01-14 08:12:47 +00:00
Dmitry Vyukov
af4b0b084a
asan: fix compilation errors in mutex
...
llvm-svn: 172385
2013-01-14 08:01:58 +00:00
Kostya Serebryany
f55e719a13
[asan] add more frames to standalone_malloc_test
...
llvm-svn: 172383
2013-01-14 07:59:09 +00:00
Dmitry Vyukov
3d462f89de
asan: add missing file
...
llvm-svn: 172381
2013-01-14 07:52:01 +00:00
Dmitry Vyukov
f22982bf0a
asan/tsan: move blocking mutex from asan to sanitizer_common
...
llvm-svn: 172380
2013-01-14 07:51:39 +00:00
Tim Northover
754d1e4932
Implement __aeabi_lcmp and ulcmp
...
Patch contributed by Andrew Turner.
llvm-svn: 172366
2013-01-13 19:18:02 +00:00
Tim Northover
0d8c9ca7e6
Correct name of __aeabi_f2lz.
...
Patch contributed by Andrew Turner.
llvm-svn: 172365
2013-01-13 19:18:00 +00:00
Dmitry Vyukov
a40a805f30
asan: fix FIXME on windows
...
llvm-svn: 172226
2013-01-11 17:57:24 +00:00
Dmitry Vyukov
ecd73d36d4
asan/tsan: faster memory allocator
...
replace lists with arrays
llvm-svn: 172217
2013-01-11 16:41:19 +00:00
Dmitry Vyukov
86585ad319
asan: add memory prefetch to quarantine recycle
...
llvm-svn: 172216
2013-01-11 16:40:24 +00:00
Dmitry Vyukov
7c6c943782
asan: add memory prefetch to quarantine recycle
...
llvm-svn: 172215
2013-01-11 16:40:01 +00:00
Dmitry Vyukov
f3a7087194
asan: improve allocator benchmark
...
llvm-svn: 172213
2013-01-11 16:22:53 +00:00
Dmitry Vyukov
f5fa4c8a77
asan: weaken memory ordering, it's expensive in current implementation
...
llvm-svn: 172210
2013-01-11 16:02:31 +00:00
Dmitry Vyukov
83c4a77265
asan: improve the benchmark
...
llvm-svn: 172209
2013-01-11 15:57:19 +00:00
Dmitry Vyukov
af96edbad2
asan: fix format string in CHECK
...
llvm-svn: 172203
2013-01-11 15:07:49 +00:00
Dmitry Vyukov
edac64ad3f
asan: prevent inlining of cold function
...
llvm-svn: 172197
2013-01-11 11:39:59 +00:00
Kostya Serebryany
9a7e8ddb21
[asan] fid asan_allocator2 build
...
llvm-svn: 172194
2013-01-11 11:27:42 +00:00
Dmitry Vyukov
008dba6aa0
asan: always pass allocator cache to Allocate()
...
llvm-svn: 172193
2013-01-11 11:15:48 +00:00
Dmitry Vyukov
b1c0dbe2c6
asan: faster quarantine
...
llvm-svn: 172192
2013-01-11 11:03:35 +00:00
Dmitry Vyukov
89698ecf8a
tsan: fix compiler warning
...
llvm-svn: 172191
2013-01-11 11:02:40 +00:00
Dmitry Vyukov
c14bb685a1
asan/tsan: fix bug in list implementation
...
llvm-svn: 172187
2013-01-11 10:15:13 +00:00
Dmitry Vyukov
0b7bce5ecf
asan: set ASAN_ALLOCATOR_VERSION=1 back
...
llvm-svn: 172184
2013-01-11 08:08:31 +00:00
Dmitry Vyukov
db0cf871d4
asan: Refactor asan memory quarantine.
...
llvm-svn: 172183
2013-01-11 08:07:43 +00:00
Dmitry Vyukov
5cb6c62641
tsan: symbolize global variables
...
llvm-svn: 172181
2013-01-11 07:23:51 +00:00
Richard Smith
ffbe87eba2
UBSan: use %p not 0x%zx when printing pointers.
...
llvm-svn: 172129
2013-01-10 22:39:40 +00:00
Will Dietz
ad5180d774
[ubsan] Move attribute specifier to fix build with gcc.
...
llvm-svn: 172078
2013-01-10 17:01:13 +00:00
Kostya Serebryany
fdcfbda750
[sanitizer] better statistics for the large allocator
...
llvm-svn: 172069
2013-01-10 13:38:38 +00:00
Kostya Serebryany
e1be48fe64
[sanitizer] fix the non-cmake build (2-nd attempt)
...
llvm-svn: 172068
2013-01-10 13:33:15 +00:00
Dmitry Vyukov
22c53df947
asan/tsan: fix comment
...
llvm-svn: 172064
2013-01-10 13:06:35 +00:00
Kostya Serebryany
1199dc0327
[sanitizer] fix the non-cmake build
...
llvm-svn: 172063
2013-01-10 13:05:16 +00:00
Kostya Serebryany
4f6e4ae44a
[sanitizer] add standalone_malloc_test
...
llvm-svn: 172061
2013-01-10 12:34:12 +00:00
Dmitry Vyukov
1bc29bd7bf
tsan: add check for invalid fd
...
llvm-svn: 172060
2013-01-10 12:28:58 +00:00
Kostya Serebryany
e54a9e6fbf
[asan] don't fail the test if prctl(PR_SET_NAME) is not supported
...
llvm-svn: 172059
2013-01-10 11:55:43 +00:00
Evgeniy Stepanov
9b52ce94db
[msan] Set program exit code in keep-going mode.
...
llvm-svn: 172057
2013-01-10 11:17:55 +00:00
Kostya Serebryany
8cc7b627b4
[asan] asan_allocator2: do less work under the quarantine lock; make the strcasecmp test more resistant to the contents of unaddressable memory
...
llvm-svn: 172048
2013-01-10 09:25:16 +00:00
Kostya Serebryany
4dd086841f
[asan] better protect the tests from memset/memcpy inlining, explicitly include unistd.h
...
llvm-svn: 172045
2013-01-10 06:38:43 +00:00
Will Dietz
e4b1d2e32c
[ubsan] Give entry methods default (not hidden) visibility.
...
Fixes using ubsan on shared libraries in linux, for example.
llvm-svn: 172041
2013-01-10 03:37:30 +00:00
Dmitry Vyukov
a626d03266
tsan: detect races on fd passed to epoll_ctl
...
llvm-svn: 171981
2013-01-09 17:31:27 +00:00
Kostya Serebryany
864ef315c0
[asan] make the slow unwinder a bit more robust. The unittests pass with fast_unwind_on_fatal=0, but I still observe some differences between the two unwinders
...
llvm-svn: 171973
2013-01-09 13:55:00 +00:00
Timur Iskhodzhanov
1d1f74cbf5
[ASan/Win] Satisfy lint
...
llvm-svn: 171970
2013-01-09 12:43:16 +00:00
Timur Iskhodzhanov
73e484aa8a
[ASan/Win] Unbreak the 32-bit RTL build
...
llvm-svn: 171968
2013-01-09 12:03:27 +00:00
Dmitry Vyukov
a681c01b69
tsan: fix crash when user defines own fopen/fileno
...
llvm-svn: 171967
2013-01-09 11:54:52 +00:00
Dmitry Vyukov
b4ede780b0
tsan: fix crash when user defines own fopen/fileno
...
llvm-svn: 171958
2013-01-09 08:22:06 +00:00
Will Dietz
b50565b21a
[ubsan] Drop use of __atomic_exchange_n for now to fix build for some.
...
Need a more reliable way to check for support of this intrinsic.
llvm-svn: 171955
2013-01-09 06:18:40 +00:00
Will Dietz
765c266892
[ubsan] Add deduplication functionality, always enabled.
...
llvm-svn: 171948
2013-01-09 03:40:03 +00:00
Will Dietz
2b40b7ef84
[ubsan] Check for appropriate types on compound assignment overflow diagnostics.
...
llvm-svn: 171802
2013-01-07 22:25:54 +00:00
Will Dietz
82f61bf4b6
[ubsan] Don't suggest casting to unsigned for unsigned unary minus overflow.
...
Fixed version of r171273.
llvm-svn: 171278
2012-12-31 06:36:44 +00:00
Chandler Carruth
5f8061bc36
Revert r171273 which doesn't actually compile.
...
Original commit message:
[ubsan] Don't suggest casting to unsigned for unsigned unary minus overflow.
llvm-svn: 171277
2012-12-31 06:16:47 +00:00
Will Dietz
d6cd3203f6
[ubsan] Don't suggest casting to unsigned for unsigned unary minus overflow.
...
llvm-svn: 171273
2012-12-31 02:20:55 +00:00
Will Dietz
2a5f569d88
[ubsan] Update test now that check recovery is default and has driver flag.
...
llvm-svn: 171265
2012-12-30 20:53:39 +00:00
Kostya Serebryany
9756e2e0b3
[asan] make LargeOOBInMemset test resistant to clever compiler optimizations
...
llvm-svn: 171223
2012-12-29 14:42:48 +00:00
Kostya Serebryany
b3d04ede8c
[asan] add a new interface function __asan_describe_address, useful for running asan-ified binary under a debugger (e.g. gdb)
...
llvm-svn: 171217
2012-12-29 10:18:31 +00:00
Kostya Serebryany
9479a85963
[asan] fix a build warning
...
llvm-svn: 171200
2012-12-28 15:55:43 +00:00
Kostya Serebryany
cb510e50e2
[asan] implement more strict checking for memset/etc parameters. Instead of checking the first and the last byte, we check the entire shadow region. This costs ~10 slowdown for the instrumented functions. Motivated by a nasty memset-buffer-overflow-by-140-bytes in chrome which was reported as a use-after-free or not at all
...
llvm-svn: 171198
2012-12-28 15:24:16 +00:00
Alexey Samsonov
1aa47efd2c
[ASan] use macro instead of raw __attribute__
...
llvm-svn: 171188
2012-12-28 11:22:23 +00:00
Alexey Samsonov
8474843e3b
[TSan] Blacklist test: Rename blacklisted function. Make this test work for custom TSan testing script.
...
llvm-svn: 171186
2012-12-28 10:06:26 +00:00
Alexey Samsonov
8c01e76d27
[TSan] Add lit test for -fsanitize-blacklist= flag
...
llvm-svn: 171185
2012-12-28 09:32:36 +00:00
Alexey Samsonov
f96bfd8849
Make ASan and TSan tests a bit less brittle with @LINE FileCheck macro
...
llvm-svn: 171181
2012-12-28 08:38:09 +00:00
Kostya Serebryany
4a42cf69a6
[sanitizer] add statistics to the allocator; fix lint
...
llvm-svn: 171161
2012-12-27 14:09:19 +00:00
Alexey Samsonov
c20f5d2246
Define COMPILER_RT_CAN_EXECUTE_TESTS variable on platforms where we can produce working binaries and use it in build rules for sanitizers tests
...
llvm-svn: 171160
2012-12-27 13:19:23 +00:00
Evgeniy Stepanov
8798729a22
[msan] Explicitly link unit tests with libstdc++.
...
llvm-svn: 171151
2012-12-27 08:44:19 +00:00
Kostya Serebryany
1302e8d6da
[asan] enable alloc_dealloc_mismatch by default
...
llvm-svn: 171147
2012-12-27 08:08:05 +00:00
Kostya Serebryany
4a0d946a43
[asan] relax asan/lit_tests/malloc_delete_mismatch.cc to make it pass on Mac 10.7 (where extra frames creep in between malloc and main)
...
llvm-svn: 171145
2012-12-27 07:40:24 +00:00
Kostya Serebryany
6f604b5007
[asan/tsan] when unmapping a chunk of user memory, apply madvise(MADV_DONTNEED) to the corresponding chunk of shadow memory. Also update sanitizer_allocator64_testlib.cc
...
llvm-svn: 171144
2012-12-27 07:37:24 +00:00
Alexey Samsonov
d66b12b701
[ASan] Teach ASan to print demangled function name when describing stack frame
...
llvm-svn: 171112
2012-12-26 14:44:46 +00:00
Kostya Serebryany
390cf94f88
[asan] asan_allocator2: do not align the requested size to the redzone size (saves a bit more memory)
...
llvm-svn: 171111
2012-12-26 12:20:35 +00:00
Kostya Serebryany
35cc75876a
[asan] asan_allocator2: implement adaptive redzones. Now with asan_allocator2 allocations <= 48 bytes have 16 byte redzone, allocations of 48-96 bytes -- have 32 bytes redzone, etc (max redzone is 2048). If ASAN_OPTIONS=redzone=n is set, it changes the minimal redzone size
...
llvm-svn: 171107
2012-12-26 10:41:24 +00:00
Evgeniy Stepanov
fee82c68ae
[msan] MSan, New Year Tree style.
...
llvm-svn: 171106
2012-12-26 10:16:45 +00:00
Evgeniy Stepanov
367dc64563
[msan] Refactor report printing.
...
llvm-svn: 171105
2012-12-26 09:32:05 +00:00
Alexey Samsonov
c914281341
[Sanitizer] attempt to fix InterlockedCompareExchangePointer intrinsic on MSVC
...
llvm-svn: 171104
2012-12-26 09:25:09 +00:00
Evgeniy Stepanov
794a73124b
[msan] Check for conflicting memory mappings.
...
Check for conflicting memory mappings before attempting to map shadow.
Helps avoid segfault on Linux with disabled ASLR.
llvm-svn: 171100
2012-12-26 06:37:23 +00:00
Kostya Serebryany
a11cd57a78
[asan] asan_allocator2: by default use the StackDepot to store the stack traces instead of storing them in the redzones
...
llvm-svn: 171099
2012-12-26 06:30:02 +00:00
Kostya Serebryany
27ad15e165
[asan] asan_allocator2: store the user requested size in just 32 bits (larger sizes use metadata). This allows to put one more 32-bit field into the chunk header
...
llvm-svn: 171089
2012-12-26 04:52:07 +00:00
Evgeniy Stepanov
84f46d9993
[msan] Improve recvfrom interceptor.
...
llvm-svn: 171071
2012-12-25 16:51:57 +00:00
Evgeniy Stepanov
a57662d7c4
Add MSan unit tests to check-msan and check-all.
...
llvm-svn: 171065
2012-12-25 13:10:15 +00:00
Evgeniy Stepanov
f45d92bb22
MemorySanitizer unit tests.
...
llvm-svn: 171062
2012-12-25 12:39:56 +00:00
Evgeniy Stepanov
6722716d78
[msan] Fix header comments.
...
llvm-svn: 171059
2012-12-25 11:53:51 +00:00
Kostya Serebryany
eff9b4b9b1
[asan] add a test for right OOB with special large sizes. Fix this test in asan_allocator2. More test tweaking for allocator2
...
llvm-svn: 171058
2012-12-25 09:40:20 +00:00
Dmitry Vyukov
116518af74
tsan: fix tests to consistently use internal functions (otherwise it leads to false positives)
...
llvm-svn: 171057
2012-12-25 09:20:58 +00:00
Kostya Serebryany
ad24c58e16
[sanitizer] increase the maximum size class of the fast allocator. This should save quite a bit of memory in tsan/msan (and later in asan). This also puts more stress on the large allocator. Add a couple of checks
...
llvm-svn: 171055
2012-12-25 07:50:35 +00:00
Dmitry Vyukov
774defc649
tsan: fix the code that searches for heap memory block metadata
...
(the old code won't work with new allocator)
llvm-svn: 171054
2012-12-25 07:45:40 +00:00
Kostya Serebryany
181f504d82
[asan] properly define ASAN_LOW_MEMORY. Due to a mistake it has been always true causing redzone and quarantine sizes to be smaller than it was some time before (and out of sync with the documentation). Also make one test less greedy
...
llvm-svn: 171052
2012-12-25 07:17:17 +00:00
Kostya Serebryany
db3250b8b3
[sanitizer] fix gcc warnings, enable one tests under asan_allocator2
...
llvm-svn: 171036
2012-12-24 14:53:13 +00:00
Kostya Serebryany
fc7de2910c
[sanitizer] make LargeMmapAllocator::GetBlockBegin faster by not using a linked list
...
llvm-svn: 171035
2012-12-24 14:35:14 +00:00
Dmitry Vyukov
19969e5045
tsan: work around FileCheck feature that it does not accept empty input
...
llvm-svn: 171034
2012-12-24 14:02:34 +00:00
Dmitry Vyukov
f6d8021520
tsan: remove static reference to glibc internal _dl_get_tls_static_info()
...
(this breaks RPM packages)
llvm-svn: 171033
2012-12-24 13:43:53 +00:00
Kostya Serebryany
ebb23c8cfa
[sanitizer] rework the size class map in the sanitizer allocator: make the differences between size classes more uniform.
...
llvm-svn: 171031
2012-12-24 13:41:07 +00:00
Dmitry Vyukov
73dac64b73
tsan: more defensive file descriptor verification
...
to prevent assertion failures on code like "write(-1, ...)"
llvm-svn: 171030
2012-12-24 11:43:34 +00:00
Kostya Serebryany
fe80f080ee
[asan] asan_allocator2 fix two asserts that happen on full chrome: a) memalign called with 0 size and large alignment and b) malloc called after TSD has been destructed
...
llvm-svn: 170900
2012-12-21 14:54:46 +00:00
Alexey Samsonov
e30a84f08f
[Sanitizer] CMake build rules for unittests: depend on headers when compiling a file with custom clang.
...
llvm-svn: 170897
2012-12-21 14:04:52 +00:00
Dmitry Vyukov
b3bf5651bd
tsan: add java malloc stress test
...
llvm-svn: 170896
2012-12-21 13:40:27 +00:00
Kostya Serebryany
a1e29adab5
[sanitizer] mmap less on every size class to make the allocator more friendly to small programs
...
llvm-svn: 170895
2012-12-21 13:38:05 +00:00
Dmitry Vyukov
c23b218520
tsan: add java rwlock test
...
llvm-svn: 170894
2012-12-21 13:31:07 +00:00
Dmitry Vyukov
c55ed2f538
tsan: add a test for java memory move
...
llvm-svn: 170893
2012-12-21 13:28:39 +00:00
Dmitry Vyukov
e6b51986bb
tsan: move common part of java tests into a separate header
...
llvm-svn: 170892
2012-12-21 13:26:10 +00:00
Dmitry Vyukov
a33bf2701e
tsan: fix Java memory move operations and add the test
...
llvm-svn: 170891
2012-12-21 13:23:48 +00:00
Dmitry Vyukov
fe817bdb88
tsan: less debug output
...
llvm-svn: 170889
2012-12-21 12:30:52 +00:00
Kostya Serebryany
3cc719fdf9
[asan] asan_allocator2: better memory stats
...
llvm-svn: 170888
2012-12-21 12:26:31 +00:00
Dmitry Vyukov
58e617121d
tsan: update mutex lock table for java
...
llvm-svn: 170885
2012-12-21 11:30:41 +00:00
Dmitry Vyukov
22be55e47e
tsan: update mutex table for java
...
llvm-svn: 170884
2012-12-21 11:30:14 +00:00
Dmitry Vyukov
a5b57100d4
tsan: java: move shadow memory on GC compaction
...
llvm-svn: 170882
2012-12-21 11:16:40 +00:00
Dmitry Vyukov
bed53cfc12
tsan: add a high-level comment to tsan_interface_java.h
...
llvm-svn: 170881
2012-12-21 10:57:59 +00:00
Alexander Potapenko
47a03a2ebe
[ASan] Fix another FileCheck pattern to be c++filt-proof.
...
llvm-svn: 170878
2012-12-21 10:48:30 +00:00
Dmitry Vyukov
11bb06039a
tsan: fix lint warnings
...
llvm-svn: 170877
2012-12-21 10:47:48 +00:00
Dmitry Vyukov
1859251df8
tsan: disable checks for limited address space and unlimited stack for Go
...
llvm-svn: 170876
2012-12-21 10:45:01 +00:00
Alexey Samsonov
53a965e125
[Sanitizer] Don't implicitly add object files to the list of dependencies when building compiler_rt unittests. Fix sanitizer_common and asan build rules accordingly. This also fixes check-sanitizer command on Ninja.
...
llvm-svn: 170870
2012-12-21 08:56:14 +00:00
Kostya Serebryany
3674c6b13b
[asan] add a flag alloc_dealloc_mismatch (off by default for now) which finds malloc/delete, new/free, new/delete[], etc mismatches
...
llvm-svn: 170869
2012-12-21 08:53:59 +00:00
Dmitry Vyukov
1fbe87d0c9
tsan: add lit test with statically linker libstdc++
...
llvm-svn: 170866
2012-12-21 08:08:19 +00:00
Dmitry Vyukov
47a5ad0348
tsan: use clang in cmake build + add -Werror
...
llvm-svn: 170844
2012-12-21 06:30:27 +00:00
Richard Relph
27cfe1c1b5
Clean up some warnings that become errors. Seen in Xcode.
...
llvm-svn: 170843
2012-12-21 05:17:13 +00:00
Dmitry Vyukov
2547ac65eb
tsan: java interface implementation skeleton
...
llvm-svn: 170707
2012-12-20 17:29:34 +00:00
Alexey Samsonov
19e8b7ecba
[ASan] remove duplicate entry in shadow byte legend
...
llvm-svn: 170701
2012-12-20 15:19:10 +00:00