Commit Graph

35 Commits

Author SHA1 Message Date
Alexey Samsonov 38b3130c7a [Sanitizer] Pass proper values to DTLS_on_libc_memalign.
Fix a surprising typo: the old code used to think that dynamic TLS
segments were several times larger than they actually are.

llvm-svn: 257722
2016-01-14 00:04:37 +00:00
Yury Gribov 67a001fd17 [asan] Correctly release memory allocated during early startup.
Calloc interceptor initially allocates memory from temp buffer (to serve dlsyms called during asan_init). There is a chance that some non-instrumented library (or executable) has allocated memory with calloc before asan_init and got pointer from the same temporary buffer which later caused problems with free.

Inspired by https://github.com/google/sanitizers/issues/626

Differential Revision: http://reviews.llvm.org/D14979

llvm-svn: 254395
2015-12-01 09:22:41 +00:00
Evgeniy Stepanov 92d20f3f90 [asan] Remove leftover debug printf.
llvm-svn: 213264
2014-07-17 13:05:21 +00:00
Evgeniy Stepanov f62cd5559e [asan] Fix malloc interception on Android L Preview.
Format of __libc_malloc_dispatch has changed in Android L.
While we are moving towards a solution that does not depend on bionic
internals, here is something to support both K* and L releases.

llvm-svn: 213263
2014-07-17 12:48:45 +00:00
Kostya Serebryany 7c163a44aa [sanitizer] support c11 aligned_alloc, Linux only for now
llvm-svn: 212322
2014-07-04 07:30:34 +00:00
Evgeniy Stepanov 63ece03c57 [asan] Add malloc_usable_size to android malloc dispatch.
llvm-svn: 210452
2014-06-09 08:36:14 +00:00
Evgeniy Stepanov e5c34ace7f [asan] Make ReplaceSystemMalloc optional on Android.
Don't fail if __libc_malloc_dispatch is missing; continue running
with normal linux interceptors instead.

llvm-svn: 210322
2014-06-06 10:57:21 +00:00
Kostya Serebryany b9e31d7fcd [asan] use some LIKELY/UNLIKELY
llvm-svn: 208776
2014-05-14 14:03:31 +00:00
Alexey Samsonov a7c602ac29 A set of trivial changes to support sanitizers on FreeBSD.
Patch by Viktor Kutuzov!

llvm-svn: 202801
2014-03-04 08:55:41 +00:00
Kostya Serebryany 71788fac2a [asan] experimental intercetor for __tls_get_addr. So far it does nothing interesting, actual usage will come later. See https://groups.google.com/forum/#!topic/address-sanitizer/BfwYD8HMxTM for background
llvm-svn: 200384
2014-01-29 09:29:16 +00:00
Alexey Samsonov 9ff4598225 [ASan] Do not rely on malloc context in allocator reports.
Invoke a fatal stack trace unwinder when ASan prints allocator-relevant
error reports (double-free, alloc-dealloc-mismatch, invalid-free).
Thus we'll be able to print complete stack trace even if allocation/free
stacks are not stored (malloc_context_size=0).

Based on the patch by Yuri Gribov!

llvm-svn: 194579
2013-11-13 14:46:58 +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 54afba8b62 [ASan] Switch ASan to generic ThreadRegistry from sanitizer_common. Delete ASan-specific AsanThreadRegistry.
llvm-svn: 177634
2013-03-21 11:23:41 +00:00
Evgeniy Stepanov 0af672326a [sanitizer] Replace more platform checks with SANITIZER_ constants.
llvm-svn: 177400
2013-03-19 14:33:38 +00:00
Evgeniy Stepanov d3b56605f1 [sanitizer] Move ASan platform macros to sanitizer_common and rename them appropriately.
llvm-svn: 177397
2013-03-19 13:54:41 +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
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 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
Kostya Serebryany 9da3dd0415 [asan] add a flag poison_heap to allow better allocator benchmarking, implemenet malloc_stats() on Linux
llvm-svn: 170685
2012-12-20 11:54:21 +00:00
Kostya Serebryany baf583c443 [asan] add two asan flags: fast_unwind_on_fatal and fast_unwind_on_malloc to allow using the slow CFI-based unwinder
llvm-svn: 170117
2012-12-13 09:34:23 +00:00
Alexey Samsonov a81d268acd [ASan] fix interception macro for Android build
llvm-svn: 163692
2012-09-12 09:42:23 +00:00
Evgeniy Stepanov be01398612 A few tweaks for building ASanRT against Android NDK.
llvm-svn: 162666
2012-08-27 11:15:55 +00:00
Alexey Samsonov 941a6ec9bb [ASan] fix names of malloc/free replacements on Android
llvm-svn: 161322
2012-08-06 15:13:22 +00:00
Kostya Serebryany 0e0832bfdb [asan] get rid of '#include <malloc.h>' in the implementation of malloc interceptors
llvm-svn: 159132
2012-06-25 09:58:29 +00:00
Chandler Carruth bbff278c9c Lots of trivial changes to remove extraneous semicolons throughout ASan.
llvm-svn: 159128
2012-06-25 06:53:10 +00:00
Alexey Samsonov 485d3dc363 Remove file-type tags for .cc files in ASan run-time library
llvm-svn: 157927
2012-06-04 13:50:10 +00:00
Kostya Serebryany 8d03204204 [asan] more renaming
llvm-svn: 157746
2012-05-31 14:35:53 +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
Alexey Samsonov e725478e2f AddressSanitizer: replace all "real_X" calls with "REAL(X)"
llvm-svn: 150073
2012-02-08 13:45:31 +00:00
Alexey Samsonov 23e3b90319 AddressSanitizer: Replace __attribute__ with macro (for Win compatibility). Patch by timurrrr@google.com
llvm-svn: 149686
2012-02-03 08:37:19 +00:00
Alexey Samsonov 15965f9c3d AddressSanitizer: Add macro for definition/declaration of interceptors
llvm-svn: 149602
2012-02-02 10:39:40 +00:00
Alexey Samsonov 2dcef2d2a8 AddressSanitizer: Enforce default visibility for all libc interceptors
llvm-svn: 149247
2012-01-30 13:42:44 +00:00
Alexey Samsonov 209c514a1d AddressSanitizer: add support for malloc_usable_size() function
llvm-svn: 148287
2012-01-17 06:39:10 +00:00
Kostya Serebryany 5dfa4da0b9 [asan] flatten the asan-rt build slightly
llvm-svn: 145631
2011-12-01 21:40:52 +00:00
Kostya Serebryany 019b76f5fd AddressSanitizer run-time library. Not yet integrated with the compiler-rt build system, but can be built using the old makefile. See details in README.txt
llvm-svn: 145463
2011-11-30 01:07:02 +00:00