Commit Graph

925 Commits

Author SHA1 Message Date
Sergey Matveev ffe38d267c Quick fix for ASan test build on Android.
llvm-svn: 181429
2013-05-08 14:11:12 +00:00
Sergey Matveev af179b8d63 [sanitizer] Move GetStackTrace from ASan to sanitizer_common.
llvm-svn: 181424
2013-05-08 12:45:55 +00:00
Sergey Matveev 0c8ed9ce44 [asan] Common flags in ASan.
Some flags that are common to ASan/MSan/TSan/LSan have been moved to
sanitizer_common.

llvm-svn: 181193
2013-05-06 11:27:58 +00:00
Alexey Samsonov 5c38383205 [ASan] Add allow_user_segv_handler to let users override SEGV handler installed by ASan
llvm-svn: 180255
2013-04-25 10:52:15 +00:00
Alexey Samsonov bcd32a9525 [ASan] Disable strict-init-order checker once we have more than one thread, as this mode is thread-hostile
llvm-svn: 180106
2013-04-23 13:57:35 +00:00
Alexander Potapenko 262eb01bbf [ASan] Make wait.cc more Darwin-compatible: fix the header name and the CHECK patterns.
llvm-svn: 180097
2013-04-23 12:36:37 +00:00
Alexander Potapenko 15aa1cd1ac [ASan] Disable AddressSanitizer.AllocDeallocMismatch on Darwin.
See https://code.google.com/p/address-sanitizer/issues/detail?id=131.

llvm-svn: 180093
2013-04-23 12:14:55 +00:00
Alexey Samsonov e7ea8cfb49 Fixup for r179843: add missing header
llvm-svn: 179844
2013-04-19 08:49:05 +00:00
Alexey Samsonov dcf0ade114 [ASan] Make init-order checker allow access to already initialized globals.
This change adds ASan runtime option "strict-init-order" (off by default)
that makes init-order checker bark if global initializer accesses any global from different
translation unit (even if the latter is already initialized). strict init-order checking
doesn't play well with, e.g. LLVM registration machineries, and causes issue 
https://code.google.com/p/address-sanitizer/issues/detail?id=178.

llvm-svn: 179843
2013-04-19 08:35:16 +00:00
Sergey Matveev 0136943e03 [asan] Fix spelling in asan_rtl.cc Test commit.
Reviewers: kcc, glider, samsonov

Reviewed By: glider

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D676

llvm-svn: 179595
2013-04-16 14:58:45 +00:00
Evgeniy Stepanov 755eb32a39 [sanitizer] Add syscall handlers to ASan and TSan runtimes.
ASan checks addressability of syscall arguments. TSan does nothing for now.

llvm-svn: 179380
2013-04-12 14:57:03 +00:00
Kostya Serebryany fd27b83ef2 [asan] inline flags(), up to 1% perf gain on malloc-intensive code
llvm-svn: 179307
2013-04-11 18:36:04 +00:00
Kostya Serebryany bb68f2cd65 [asan] make heavy_uar_test even heavier
llvm-svn: 179306
2013-04-11 18:27:02 +00:00
Alexey Samsonov 9f3938e271 Explicitly list all sanitizer headers in CMake build rules. Make sure sanitizer lit_tests depend on fresh headers.
llvm-svn: 179293
2013-04-11 15:49:52 +00:00
Kostya Serebryany 1c77de3aeb [asan] improve the UAR reporting (try harder to find the correct frame), try to make the test more stable
llvm-svn: 179292
2013-04-11 15:35:40 +00:00
Kostya Serebryany 18f0820552 [asan] make heavy_uar_test a bit more heavy and fix he fake stack to pass this test
llvm-svn: 179286
2013-04-11 14:07:02 +00:00
Alexey Samsonov a672ba6e8f [ASan] test source-based init-order blacklisting added in r179280
llvm-svn: 179281
2013-04-11 13:21:41 +00:00
Kostya Serebryany 3fec2f534a [asan] fix use-after-return functionality (PR15672) and enable the corresponding test. We still don't guarantee anything with regard to use-after-return checking
llvm-svn: 179278
2013-04-11 12:49:38 +00:00
Alexey Samsonov 46cc45a291 [ASan] Symbolize correct address when printint error summary
llvm-svn: 179274
2013-04-11 11:45:04 +00:00
Kostya Serebryany 4e0a33c8be [asan] move fake stack into a separate .h file; actually disable a failing test
llvm-svn: 179273
2013-04-11 11:39:19 +00:00
Kostya Serebryany fd7f924016 [asan] add heavy_uar_test (disabled); fix lint
llvm-svn: 179271
2013-04-11 11:29:07 +00:00
Alexander Potapenko 227e22de5a [ASan] Do not check the shadow of NULL argument in the time() interceptor.
Add a test for time().

llvm-svn: 179177
2013-04-10 15:13:00 +00:00
Kostya Serebryany 92684efb1d [asan] implement callbacks for unaligned loads/stores
Reviewers: samsonov

Reviewed By: samsonov

CC: samsonov, llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D652

llvm-svn: 179175
2013-04-10 13:59:32 +00:00
Alexey Samsonov c0443c5d25 [ASan] fix a typo in legend in error report
llvm-svn: 179161
2013-04-10 07:00:25 +00:00
Evgeniy Stepanov 460067823b [sanitizer] Interceptors for wait*.
llvm-svn: 179096
2013-04-09 14:34:59 +00:00
Evgeniy Stepanov 69967c2835 [msan] Intercept glob() with tests.
llvm-svn: 179091
2013-04-09 11:35:13 +00:00
Kostya Serebryany 9d28efc1ad [asan] relax Linux/zero-base-shadow.cc to make it pass on newer Ubuntu; fix lint
llvm-svn: 179088
2013-04-09 07:08:05 +00:00
Kostya Serebryany 228ecf46ab [asan] make huge_negative_hea_oob more meaningful
llvm-svn: 178876
2013-04-05 15:16:48 +00:00
Kostya Serebryany f5407e8d8f [asan] add a test for huge left oob
llvm-svn: 178874
2013-04-05 15:13:23 +00:00
Kostya Serebryany 5b4267f7e7 [sanitizer] found a bug by code inspection: CHECK(a=b) instead of CHECK(a==b). Was puzzled why lint did not catch it. Turns out this check was disabled for asan source. fix all cases and enable the check
llvm-svn: 178872
2013-04-05 14:40:25 +00:00
Alexey Samsonov 5afe6aa141 [ASan] init-order checker tests: move constexpr test that requires -std=c++11 to a separate test case. Check that structs with no ctor but non-trivial dtor are ignored.
llvm-svn: 178857
2013-04-05 07:51:49 +00:00
Alexey Samsonov 734aab4066 [Sanitizer] Use a common mutex to prevent mixing reports from different sanitizers. This fixes PR15516
llvm-svn: 178853
2013-04-05 07:30:29 +00:00
Kostya Serebryany eef8bd4355 [asan] nuke the old unused allocator code
llvm-svn: 178758
2013-04-04 11:32:49 +00:00
Kostya Serebryany 13b07733b1 [asan] fill first 4K of malloc-ed memory with garbage, implement flags max_malloc_fill_size and malloc_fill_byte
llvm-svn: 178757
2013-04-04 11:17:14 +00:00
Alexey Samsonov 21cb74318c [ASan] Kill the remainders of platform defines in favor of SANITIZER_ defines
llvm-svn: 178629
2013-04-03 07:29:53 +00:00
Alexey Samsonov e624795558 [ASan] More careful reports for globals that are ASCII strings
llvm-svn: 178458
2013-04-01 08:57:38 +00:00
Timur Iskhodzhanov 07d06d7cf5 Remove all 'static' before ALWAYS_INLINE
llvm-svn: 178290
2013-03-28 21:16:09 +00:00
Timur Iskhodzhanov a6788325cf Make all the ALWAYS_INLINE users Windows-friendly; also, avoid ALWAYS_INLINE INLINE combinations
llvm-svn: 178266
2013-03-28 18:52:40 +00:00
Alexey Samsonov a88c60b085 [ASan] Speed-up initialization-order checking: create and use fast versions of PoisonShadow functions, store copies of __asan_global descriptors in a vector instead of list of pointers. This gives 3x speedup on both benchmarks and real binaries with lots of globals.
llvm-svn: 178239
2013-03-28 15:42:43 +00:00
Alexey Samsonov e586170e86 Fix unmatching ASan runtime flag for init-order checking exposed by r178158. Add a test for r178158.
llvm-svn: 178229
2013-03-28 09:11:20 +00:00
Alexey Samsonov 7152debedd [ASan] Demangle global names in error reports.
llvm-svn: 178131
2013-03-27 10:41:22 +00:00
Alexey Samsonov 56a784d2f6 [ASan] Change the ABI of __asan_before_dynamic_init function: now it takes pointer to private string with module name. This string serves as a unique module ID in ASan runtime. compiler-rt part
llvm-svn: 178014
2013-03-26 13:06:12 +00:00
Dmitry Vyukov 6f4b34bcf4 asan/tsan: move strcasecmp() interceptor to sanitizer_common
llvm-svn: 178010
2013-03-26 12:40:23 +00:00
Kostya Serebryany 88b2b45ec8 [asan] print thread number while reporting invalid-free and double-free; add tests; also add a test for use-after-poison
llvm-svn: 177993
2013-03-26 08:01:37 +00:00
Alexey Samsonov 961b636cf1 [ASan] Use dynamic symbol table when checking exported ASan runtime symbols
llvm-svn: 177868
2013-03-25 13:47:53 +00:00
Alexey Samsonov 9328ba400a [ASan] mark local function as static
llvm-svn: 177862
2013-03-25 11:38:42 +00:00
Richard Smith c91e327cba Build and install .syms files alongside sanitizer runtimes. These are used to
specify which symbols are exported to DSOs when the sanitizer is statically
linked into a binary.

llvm-svn: 177784
2013-03-23 00:31:07 +00:00
Timur Iskhodzhanov fb74020cea Revert 177745 as it was incorrect
llvm-svn: 177746
2013-03-22 18:16:57 +00:00
Timur Iskhodzhanov e117eef77f Band-aid fix for the Windows build caused by r177710. Long-term, atomic_compare_exchange_strong should be a template on Windows too...
llvm-svn: 177745
2013-03-22 18:05:28 +00:00
Kostya Serebryany 667a34a120 [asan] Change the way we report the alloca frame on stack-buff-overflow.
Before: the function name was stored by the compiler as a constant string
and the run-time was printing it.
Now: the PC is stored instead and the run-time prints the full symbolized frame.
This adds a couple of instructions into every function with non-empty stack frame,
but also reduces the binary size because we store less strings (I saw 2% size reduction).
This change bumps the asan ABI version to v3.

compiler-rt part, llvm part will follow.

Example of report (now):
==31711==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffa77cf1c5 at pc 0x41feb0 bp 0x7fffa77cefb0 sp 0x7fffa77cefa8
READ of size 1 at 0x7fffa77cf1c5 thread T0
    #0 0x41feaf in Frame0(int, char*, char*, char*) stack-oob-frames.cc:20
    #1 0x41f7ff in Frame1(int, char*, char*) stack-oob-frames.cc:24
    #2 0x41f477 in Frame2(int, char*) stack-oob-frames.cc:28
    #3 0x41f194 in Frame3(int) stack-oob-frames.cc:32
    #4 0x41eee0 in main stack-oob-frames.cc:38
    #5 0x7f0c5566f76c (/lib/x86_64-linux-gnu/libc.so.6+0x2176c)
    #6 0x41eb1c (/usr/local/google/kcc/llvm_cmake/a.out+0x41eb1c)
Address 0x7fffa77cf1c5 is located in stack of thread T0 at offset 293 in frame
    #0 0x41f87f in Frame0(int, char*, char*, char*) stack-oob-frames.cc:12  <<<<<<<<<<<<<< this is new
  This frame has 6 object(s):
    [32, 36) 'frame.addr'
    [96, 104) 'a.addr'
    [160, 168) 'b.addr'
    [224, 232) 'c.addr'
    [288, 292) 's'
    [352, 360) 'd'

llvm-svn: 177723
2013-03-22 10:36:24 +00:00