Commit Graph

1882 Commits

Author SHA1 Message Date
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
Alexey Samsonov 5cb7860129 [CMake] set -mmacosx-version-min to 10.7 if compiler-rt is built with -stdlib=libc++
llvm-svn: 174699
2013-02-08 07:39:25 +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