Commit Graph

279 Commits

Author SHA1 Message Date
Kostya Serebryany d45a71c2bc [asan] test for issue #66
llvm-svn: 155127
2012-04-19 14:53:51 +00:00
Alexander Potapenko ec316e5940 Partially revert r154390 (http://llvm.org/viewvc/llvm-project?view=rev&revision=154390)
Until we work out the solution for http://code.google.com/p/address-sanitizer/issues/detail?id=65 we'd better not allow
the clients to override AddressSanitizer's signal handler.

The second part of r154390 (removing the sighandler-related tests) is not reverted, because those tests were broken
and didn't test anything.

llvm-svn: 154803
2012-04-16 08:33:01 +00:00
Alexey Samsonov cc0b3e6607 [asan] minor fix: pass flag -g to output tests as a part of CXXFLAGS
llvm-svn: 154589
2012-04-12 13:31:13 +00:00
Alexey Samsonov a5f6fd9884 [ASan] fix output tests - r154570 changed debug info for static functions and now they are symbolized a bit differently
llvm-svn: 154581
2012-04-12 07:32:08 +00:00
Alexander Potapenko bc42d44112 Change the way ASan interacts with custom signal handlers.
From now on we allow the clients to override signal handlers set by ASan, but print a warning in such a case.

Remove the tests for signal() and sigaction(), because they made little sense even without this change.

llvm-svn: 154390
2012-04-10 11:00:26 +00:00
Alexey Samsonov 7ec936a4f4 [ASan] remove dispatch.h header once again - it's not present on Leopard, and we don't want to break the build of compiler-rt there. See https://trac.macports.org/ticket/33362
llvm-svn: 154326
2012-04-09 16:45:18 +00:00
Timur Iskhodzhanov 36a7cc6292 Use 'typename' instead of 'class' in template<> definitions supporting POD types
llvm-svn: 154314
2012-04-09 11:50:27 +00:00
Kostya Serebryany d2863dab85 [asan] last bit for gcc compatibility
llvm-svn: 154203
2012-04-06 20:36:18 +00:00
Kostya Serebryany b7f68dee45 [asan] minor change to please gcc
llvm-svn: 154201
2012-04-06 20:19:59 +00:00
Alexey Samsonov 6a19d5d209 [ASan] move replacements for new/delete to separate file
llvm-svn: 154167
2012-04-06 08:21:08 +00:00
Kostya Serebryany 1490c7996f [asan] add flags: disable_core, abort_on_error and unmap_shadow_on_exit
llvm-svn: 154159
2012-04-06 01:27:11 +00:00
Timur Iskhodzhanov 889a3009a4 [ASan/Win] Revert the local Makefile change slipped into the prev commit
llvm-svn: 154112
2012-04-05 18:33:17 +00:00
Timur Iskhodzhanov 7d2776960b [ASan/Win] Fix lint warning
llvm-svn: 154111
2012-04-05 18:31:50 +00:00
Timur Iskhodzhanov 0881092306 [ASan/Win] Fix build by using inline assembly instead of an unavailable intrinsic function
llvm-svn: 154106
2012-04-05 17:16:32 +00:00
Kostya Serebryany 7a8f5e4d1e [asan] make __asan::Deallocate immune to racy double-free (issue #57)
llvm-svn: 154097
2012-04-05 15:55:09 +00:00
Alexander Potapenko 08342aa1a1 Introduce the use_sigaltstack flag (off by default), which enables using alternate
per-thread stacks for signal handling. This allows to print more verbose error reports
for stack overflows.

llvm-svn: 154092
2012-04-05 10:54:52 +00:00
Alexander Potapenko 44016da83f Allow calling GetCurrentTidOrMinusOne() before AsanThreadRegistry was initialized.
llvm-svn: 154091
2012-04-05 10:10:57 +00:00
Chandler Carruth 1f5d5c0e13 Initial, very rough cut at a new CMake build system for compiler-rt.
Some high-level notes:

1) An explicit goal is to support building compiler-rt as a subproject
   build, checked out into the projects/compiler-rt directory. There are
   many other possible ways of building the code here, but this is
   optimized for development on LLVM/Clang/compiler-rt, and incremental
   trial and testing of the toolchain.
2) The current support is targeted at Linux. I would love to see this
   generalized to other platforms, but for the sake of simplicity in
   testing, I'm focusing here first.

Much of this patch was paired with Manuel, and I credit him with the
majority of the work here.

Some important caveats that I'll be working on in subsequent patches:

1) This uses the host compiler rather than using the just-built-clang.
2) Currently only x86 is supported.
3) Currently, none of the tests are built or run.
4) Uses CMake's builtin globbing which doesn't update correctly.
5) This is still turned off from LLVM's CMake build until these issues
   are addressed

llvm-svn: 154060
2012-04-04 22:12:04 +00:00
Alexey Samsonov 61a331d594 [ASan] use correct C-version of strchr on Windows
llvm-svn: 154006
2012-04-04 11:36:47 +00:00
Alexander Potapenko 4f1d3e8eaa Make sure NSObjects are allocated in a way that is visible to ASan.
llvm-svn: 153762
2012-03-30 17:31:15 +00:00
Alexander Potapenko c6eb6a8287 Add internal_memset and replace the uses of REAL(memset) with it where the performance allows.
llvm-svn: 153641
2012-03-29 12:20:47 +00:00
Alexey Samsonov b33c87bbb9 [ASan] interceptors for atoi/atol/atoll
llvm-svn: 153637
2012-03-29 08:04:35 +00:00
Kostya Serebryany b0414e0eff [asan] fix lint
llvm-svn: 153601
2012-03-28 21:03:34 +00:00
Kostya Serebryany 48c157c25a [asan] add racy double-free test
llvm-svn: 153586
2012-03-28 18:30:10 +00:00
Alexander Potapenko 8418de1689 Log the allocator messages at a higher verbosity level.
llvm-svn: 153514
2012-03-27 16:37:16 +00:00
Alexey Samsonov 0a4f8dc0cb [ASan] add interceptor for strtol
llvm-svn: 153444
2012-03-26 16:42:22 +00:00
Evgeniy Stepanov 4cc2631c7d Avoid including link.h.
It's not available on Android. We only use this header to find out if _DYNAMIC
is present; declaring it "extern void*" does the trick.

llvm-svn: 153431
2012-03-26 09:48:41 +00:00
Alexey Samsonov 1fd5dbc140 [ASan] use macro to define if we should intercept signal/sigaction
llvm-svn: 153430
2012-03-26 09:07:29 +00:00
Alexey Samsonov f71cb8d307 [ASan] revert r153378
llvm-svn: 153379
2012-03-24 10:12:58 +00:00
Alexey Samsonov 01da1055d3 [ASan] simplify ASAN_INTERCEPT_* definitions
llvm-svn: 153378
2012-03-24 09:47:56 +00:00
Alexey Samsonov 78481835ae [ASan] use ASAN_INTERCEPT_STRNLEN instead of defined(__APPLE__)
llvm-svn: 153377
2012-03-24 09:10:50 +00:00
Alexey Samsonov c8efe828a9 [ASan] add interceptor for strtoll
llvm-svn: 153376
2012-03-24 08:39:14 +00:00
Timur Iskhodzhanov 99cc6235bc [ASan/tests] Make 'noinline' and a bunch of other stuff portable
llvm-svn: 153333
2012-03-23 13:10:59 +00:00
Timur Iskhodzhanov f392910965 [ASan] replace '#if ... or ...' with '#if ... || ...'
llvm-svn: 153332
2012-03-23 12:21:47 +00:00
Timur Iskhodzhanov 72859836ab [ASan] Add a few more malloc-related interceptors for Windows
llvm-svn: 153327
2012-03-23 11:33:02 +00:00
Alexander Potapenko 83a689887e Handle two-byte short jumps in the relocated code.
After the instructions are moved to the branch island, fixupInstructions() expands every 2-byte ja/je instruction with a 1-byte offset into a 6-byte ja/je with 32-bit offset. The offset is fixed to point to the original function.

llvm-svn: 153249
2012-03-22 11:29:53 +00:00
Kostya Serebryany 3f56851f5c [asan] extend the test for long double bug
llvm-svn: 153190
2012-03-21 15:29:28 +00:00
Alexey Samsonov b8a047261c [asan] one more try to remove pthread.h from asan_interceptors.cc
llvm-svn: 153188
2012-03-21 15:02:39 +00:00
Alexey Samsonov 9113f3e000 [asan] add missing declarations from string.h and remove this header
llvm-svn: 153187
2012-03-21 14:33:15 +00:00
Alexey Samsonov abbcccc187 [asan] use extern declaraions of libc functions on Win and on Mac
llvm-svn: 153186
2012-03-21 14:22:28 +00:00
Alexey Samsonov ef50dfd6aa [asan]: remove signal.h system header from interceptors
llvm-svn: 153183
2012-03-21 13:44:39 +00:00
Alexey Samsonov 8ada45553d [asan]: substitute extern decls with system header in asan_mac.cc
llvm-svn: 153182
2012-03-21 13:00:04 +00:00
Alexey Samsonov 9ce04b0c36 [asan] merge mac-specific interceptors into one function
llvm-svn: 153180
2012-03-21 12:42:00 +00:00
Alexey Samsonov 5f7048b396 [asan]: remove asan_mac.h
llvm-svn: 153179
2012-03-21 12:29:54 +00:00
Alexey Samsonov 1d4145380e [asan]: start removing os-specific asan_mac.h - move inclusion of mac system header to asan_mac.cc
llvm-svn: 153178
2012-03-21 12:03:44 +00:00
Evgeniy Stepanov 823085a8f4 [asan] Support for %z to Printf()
At the moment, asan internal Printf() uses %l modifier for printing
values of size_t and related types. This works, because we control
both the implementation of Printf and all its uses, but can be a
little misleading.

This change adds support for %z to Printf(). All callers that print
sizes and pointers as integers are switched to %zu / %zx.

llvm-svn: 153177
2012-03-21 11:32:46 +00:00
Alexander Potapenko 1159250518 s/Printf/Report for libc interceptors (need this to debug the potential double interception)
llvm-svn: 153175
2012-03-21 09:33:05 +00:00
Alexey Samsonov 1479418407 [ASan] get rid of setjmp.h header in interceptors
llvm-svn: 153085
2012-03-20 11:40:09 +00:00
Alexey Samsonov c298b3674f [ASan]: remove GetMacosVersion from asan_mac.h header
llvm-svn: 153084
2012-03-20 10:54:40 +00:00
Alexey Samsonov cae79fbab9 [ASan]: re-enable noreturn attribute on posix
llvm-svn: 153082
2012-03-20 10:14:55 +00:00