Kostya Serebryany
875f99a6bf
[asan] fix -Wsign-compare
...
llvm-svn: 159083
2012-06-23 16:30:48 +00:00
Alexey Samsonov
f8947a3360
[ASan] fix lint error
...
llvm-svn: 158905
2012-06-21 08:13:49 +00:00
Alexander Potapenko
1bde28b464
Factor the common code out of cf_free and mz_free.
...
Introduce the mac_ignore_invalid_free flag (0 by default) which makes both cf_free and mz_free ignore invalid free invocations and leak memory.
llvm-svn: 158885
2012-06-21 01:01:20 +00:00
Alexey Samsonov
156958dd0c
[Sanitizer] move all the rest re-implementations of libc functions from ASan runtime to common sanitizer runtime
...
llvm-svn: 158519
2012-06-15 13:09:52 +00:00
Alexey Samsonov
40e5128412
[Sanitizer] move ShadowRangeIsAvailable and several defines to common runtime
...
llvm-svn: 158499
2012-06-15 07:29:14 +00:00
Alexey Samsonov
ae1e171b72
[Sanitizer] move DumpProcessMap and DisableCoreDumper to common runtime
...
llvm-svn: 158490
2012-06-15 06:08:19 +00:00
Alexey Samsonov
c70d1086f6
[Sanitizer] move rest of mmap routines to common sanitizer runtime
...
llvm-svn: 158452
2012-06-14 14:42:58 +00:00
Alexey Samsonov
0c53a38abb
[Sanitizer] move portable GetEnv to common sanitizer runtime
...
llvm-svn: 158451
2012-06-14 14:07:21 +00:00
Kostya Serebryany
0b14fd855b
[asan] slow 16-byte redzones (still experimental)
...
llvm-svn: 158143
2012-06-07 09:15:48 +00:00
Alexey Samsonov
fe44fbd750
[Sanitizer] Move ReadFileToBuffer to sanitizer_common.
...
llvm-svn: 158138
2012-06-07 05:38:26 +00:00
Alexey Samsonov
40d5b772e5
[Sanitizer] Switch to common mmap/munmap routines in ASan run-time.
...
llvm-svn: 158078
2012-06-06 16:15:07 +00:00
Alexey Samsonov
e428779dbf
[Sanitizer] Use common CHECK machinery. Currently each tool has to define its own CheckFailed function.
...
llvm-svn: 158075
2012-06-06 15:22:20 +00:00
Kostya Serebryany
79437fe376
[asan] make tid u32 instead of int
...
llvm-svn: 158074
2012-06-06 15:06:58 +00:00
Alexey Samsonov
51ae983718
[Sanitizer]: Introduce a common internal printf function. For now, also use tool-specific wrappers TsanPrintf (its output is controlled by TSan flags) and AsanPrintf (which copies its results to the ASan-private buffer). Supported formats: %[z]{d,u,x}, %s, %p. Re-write all format strings in TSan according to this format (this should have no effect on 64-bit platforms).
...
llvm-svn: 158065
2012-06-06 13:11:29 +00:00
Alexey Samsonov
cd96c44dce
[ASan] more format fixes
...
llvm-svn: 158060
2012-06-06 10:54:25 +00:00
Alexey Samsonov
461820ad67
[ASan] Make printf arguments match format strings better.
...
llvm-svn: 158059
2012-06-06 10:46:00 +00:00
Alexey Samsonov
c4b201308b
[ASan] Use __sanitizer::Die() in ASan runtime.
...
llvm-svn: 158051
2012-06-06 07:02:44 +00:00
Alexey Samsonov
8602c65719
[Sanitizer] remove using namespace __sanitizer lines
...
llvm-svn: 157999
2012-06-05 14:05:09 +00:00
Alexey Samsonov
ef2e2cfd33
[Sanitizer] Use common defines for ASan and TSan runtime. Split defines between interface defines (can be visible in user code that includes interface ASan/TSan headers) and internal defines.
...
llvm-svn: 157998
2012-06-05 13:50:57 +00:00
Alexey Samsonov
1b12eda7ec
[ASan] use internal_{close,read,write} in ASan runtime.
...
llvm-svn: 157991
2012-06-05 08:48:10 +00:00
Alexey Samsonov
f5e2dc3c3d
[ASan] use internal_open from sanitizer_libc in ASan runtime
...
llvm-svn: 157986
2012-06-05 07:25:47 +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
Alexey Samsonov
4ecc8f43c7
[ASan] Use ASan option symbolize to turn on internal symbolizer (in development)
...
llvm-svn: 157924
2012-06-04 11:20:17 +00:00
Kostya Serebryany
1d35d155fd
[asan] more renaming
...
llvm-svn: 157747
2012-05-31 15:02:07 +00:00
Kostya Serebryany
8d03204204
[asan] more renaming
...
llvm-svn: 157746
2012-05-31 14:35:53 +00:00
Kostya Serebryany
1b71207f48
[asan,tsan] introduce sanitizer_common/sanitizer_defs.h and perform some renaming in asan rt. More to come.
...
llvm-svn: 157743
2012-05-31 14:11:07 +00:00
Alexander Potapenko
6e216bea86
Fix a bug in parsing boolean flags: we used to take the first char of the key=value string
...
instead of the first character of the value.
llvm-svn: 157692
2012-05-30 15:28:45 +00:00
Alexander Potapenko
93b2c7d516
Be less verbose when parsing the default options.
...
llvm-svn: 157691
2012-05-30 14:12:20 +00:00
Kostya Serebryany
458b4006b2
[asan,tsan] Add a new directory compiler-rt/lib/sanitizer_common
...
which will contain code shared between asan and tsan run-times.
Naming is hard. If you can suggest a better name for the directory -- speak up.
llvm-svn: 157611
2012-05-29 12:18:18 +00:00
Alexey Samsonov
1cbe656d66
Fixing ASan build on Win: don't use __asan_default_options
...
llvm-svn: 157608
2012-05-29 09:39:01 +00:00
Alexander Potapenko
0efd915d92
Rework the flags machinery a bit.
...
Clients may define the __asan_default_options char string containing the default options for the tool now.
llvm-svn: 157582
2012-05-28 16:21:19 +00:00
Alexander Potapenko
4e424b85e3
Typo fix.
...
llvm-svn: 157477
2012-05-25 15:56:40 +00:00
Alexander Potapenko
85e93ef612
Factor ParseAsanOptions outside __asan_init
...
llvm-svn: 157473
2012-05-25 15:37:16 +00:00
Alexander Potapenko
442002568c
Introduce the check_malloc_usable_size flag (on by default).
...
When the flag is set to zero, we do not check for errors in malloc_usable_size.
This may be useful to work around a bug in Nvidia drivers prior to 295.*
llvm-svn: 157472
2012-05-25 15:20:13 +00:00
Alexander Potapenko
a1c3c6582c
Increase error_message_buffer_size to 64K (16K is insufficient for large programs)
...
llvm-svn: 156711
2012-05-12 12:33:41 +00:00
Alexander Potapenko
66e6de10cf
Fix ReadFileToBuffer to return 0 on failure (-1 is too large if returned as size_t).
...
llvm-svn: 156538
2012-05-10 12:03:09 +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
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
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
cae79fbab9
[ASan]: re-enable noreturn attribute on posix
...
llvm-svn: 153082
2012-03-20 10:14:55 +00:00
Alexander Potapenko
fa391a7df2
[ASan] Print the parsed ASAN_OPTIONS for verbosity>0.
...
Move the flags around slightly.
llvm-svn: 152929
2012-03-16 16:38:31 +00:00
Kostya Serebryany
54a3cac5c5
[asan] fix unwinding inside libc intercepors (asan issue #46 )
...
llvm-svn: 152768
2012-03-15 01:36:00 +00:00
Kostya Serebryany
baf68ffcf8
[asan] fix -Wnull-conversion warnings
...
llvm-svn: 152747
2012-03-14 22:48:09 +00:00
Alexander Potapenko
b780ad9117
Force __asan_handle_no_return into the binary built with ASan.
...
llvm-svn: 152117
2012-03-06 11:45:59 +00:00
Alexander Potapenko
8e9d772c5a
Force __asan_set_death_callback into the resulting binary.
...
llvm-svn: 151808
2012-03-01 14:39:21 +00:00
Alexander Potapenko
7e07f56811
Introduce __asan_set_error_report_callback() to allow the client program post-process the error reports.
...
If the callback is set, Report() and Printf() print the reports into a buffer (together with stderr), which is then passed to the client.
llvm-svn: 151528
2012-02-27 14:06:48 +00:00
Evgeniy Stepanov
d84e16e6a3
Replace some #ifdef(s) with plain if(s).
...
llvm-svn: 151526
2012-02-27 13:07:29 +00:00
Alexey Samsonov
d6651509d0
AddressSanitizer: get rid of stdlib.h and add (smaller) stddef.h instead
...
llvm-svn: 151162
2012-02-22 14:07:06 +00:00
Timur Iskhodzhanov
94602b48ee
[ASan] Fix style + suppress 'long' lint warnings
...
llvm-svn: 151149
2012-02-22 09:28:14 +00:00
Alexander Potapenko
2c0ed61c7a
Move the contents of AsanProcMaps::Dump() into AsanDumpProcessMaps() for Posix systems.
...
Define AsanDumpProcessMaps as unimplemented on Windows.
This should fix the Windows build.
llvm-svn: 151147
2012-02-22 09:11:55 +00:00
Alexander Potapenko
c259ab3cac
Dump the process memory map if any of the mappings interleaves with the shadow.
...
llvm-svn: 151141
2012-02-22 08:27:32 +00:00
Timur Iskhodzhanov
a1c987ff38
[ASan] Add __asan_init to the list of C dynamic initializers to support /MD on Windows
...
llvm-svn: 151059
2012-02-21 16:24:23 +00:00
Alexey Samsonov
0d0b406aba
AddressSanitizer: use custom strtol/atoll functions
...
llvm-svn: 150812
2012-02-17 16:15:09 +00:00
Alexey Samsonov
8e7bfceb98
AddressSanitizer: fix lint
...
llvm-svn: 150802
2012-02-17 08:31:10 +00:00
Evgeniy Stepanov
5d47e9164c
[asan] Allocator tweaks for low memory systems.
...
llvm-svn: 150689
2012-02-16 13:35:11 +00:00
Kostya Serebryany
10dbd68bd2
[asan] don't do AsanDie twice
...
llvm-svn: 150641
2012-02-16 00:40:18 +00:00
Timur Iskhodzhanov
d2a9075de0
[ASan] Define an internal implementation of strchr to make stack OOB tests pass on Windows
...
llvm-svn: 150499
2012-02-14 19:33:04 +00:00
Kostya Serebryany
fcd535ba6c
[asan] implement __asan_set_death_callback
...
llvm-svn: 150414
2012-02-13 21:24:29 +00:00
Alexander Potapenko
720aaefb8d
Move the non-trivial implementation of AsanShadowRangeIsAvailable to asan_mac.cc
...
to avoid crashes on Linux and Win.
llvm-svn: 150398
2012-02-13 17:09:40 +00:00
Alexander Potapenko
ef4521e239
Check whether the shadow memory range intersects with an existing mapping.
...
This should help to detect problems with ASLR or linker tricks early.
llvm-svn: 150391
2012-02-13 15:11:23 +00:00
Evgeniy Stepanov
45fd36110b
[asan] Default visibility for __asan_handle_no_return.
...
llvm-svn: 150372
2012-02-13 11:55:24 +00:00
Timur Iskhodzhanov
7ce3e5bb8e
[asan] The first version of the RTL for Windows, reviewed at http://codereview.appspot.com/5647052
...
llvm-svn: 150185
2012-02-09 17:20:14 +00:00
Kostya Serebryany
0394da7bea
[asan] unpoison the stack before every noreturn call. Fixes asan issue 37. rt part
...
llvm-svn: 150101
2012-02-08 21:33:27 +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
Kostya Serebryany
bca91defcb
[asan] new run-time flag: sleep_before_dying (asan Issue #31 )
...
llvm-svn: 149306
2012-01-31 00:52:18 +00:00
Alexander Potapenko
f519564d7c
Make compiler-rt/trunk/lib/asan compileable with Visual Studio 2008 on Windows.
...
Patch by Timur Iskhodzhanov (timurrrr@google.com )
To test:
$ cl /c *.c*
in the asan directory.
The code fails to link if you omit the "/c" part but that's one of the
next steps,
as well as a few TODO's I've put into the Windows-specific code.
llvm-svn: 149130
2012-01-27 15:15:04 +00:00
Evgeniy Stepanov
84c44a8b8b
EHABI-based stack trace on ARM.
...
The change removes the unused FLAG_fast_unwind, and forces EHABI-based unwind
on ARM, and fast (FP-based) unwind everywhere else.
llvm-svn: 148468
2012-01-19 11:34:18 +00:00
Kostya Serebryany
86d4492627
[asan] fix ReadFileToBuffer to correctly handle files from /proc/ (asan issue 27)
...
llvm-svn: 148311
2012-01-17 18:00:07 +00:00
Alexander Potapenko
553c208d22
This patch moves the code reading /proc/self/environ into AsanGetEnv
...
in asan_linux.cc, because /proc is unavailable on Mac.
Instead the Mac version of AsanGetEnv iterates over the array of
environment variables obtained from _NSGetEnviron()
llvm-svn: 148114
2012-01-13 12:59:48 +00:00
Evgeniy Stepanov
837fe5bcc9
Call asan_init from .preinit_array.
...
Protected by an #ifdef, disabled by default.
llvm-svn: 147932
2012-01-11 08:17:19 +00:00
Kostya Serebryany
0c8fa7b8ed
[asan] remove OS-dependent includes from asan_interceptors.h
...
llvm-svn: 147916
2012-01-11 02:32:40 +00:00
Kostya Serebryany
edb4a8a128
[asan] don't include unistd.h in the headers
...
llvm-svn: 147811
2012-01-09 23:11:26 +00:00
Kostya Serebryany
65518014e2
[asan] don't use strstr/strncat from libc, use our own versions instead
...
llvm-svn: 147807
2012-01-09 22:20:49 +00:00
Kostya Serebryany
5be458ccfd
[asan] refactoring: move some common linux/mac code to asan_posix.cc
...
llvm-svn: 147788
2012-01-09 19:18:27 +00:00
Kostya Serebryany
9fd01e5ea5
[asan] refactoring: move all interceptors to a single file
...
llvm-svn: 147784
2012-01-09 18:53:15 +00:00
Kostya Serebryany
3f4b9bb4a0
[asan] do not use new/delete for the internal thread structure
...
llvm-svn: 147674
2012-01-06 19:44:11 +00:00
Kostya Serebryany
25d6c1b3c3
[asan] move more code into OS-specific files
...
llvm-svn: 147671
2012-01-06 19:11:09 +00:00
Kostya Serebryany
adebf0caf5
[asan] cleanup: remove the SIGILL-related code (rt part)
...
llvm-svn: 147665
2012-01-06 18:02:04 +00:00
Kostya Serebryany
2b08718bba
[asan] move more stuff to OS-specific files
...
llvm-svn: 147647
2012-01-06 02:12:25 +00:00
Kostya Serebryany
cd271f5440
[asan] implement our own /proc/self/maps reader and use it on linux instead of sysinfo.h
...
llvm-svn: 147581
2012-01-05 00:44:33 +00:00
Kostya Serebryany
d2d043be45
[asan] force the __asan_unregister_globals to reside in the runtime library
...
llvm-svn: 147329
2011-12-28 23:35:46 +00:00
Kostya Serebryany
a772096156
[asan] refactoring: don't #include <sys/mman.h> in non-os-specific files
...
llvm-svn: 147328
2011-12-28 23:28:54 +00:00
Kostya Serebryany
6c4bd806fa
[asan] use custom libc-free getenv; a bit of refactoring around mmap calls
...
llvm-svn: 147326
2011-12-28 22:58:01 +00:00
Kostya Serebryany
2b87e403c4
[asan] no ucontext on Android. patch by eugeni.stepanov@gmail.com
...
llvm-svn: 147320
2011-12-28 20:22:21 +00:00
Kostya Serebryany
76eca5e53a
[asan] enable memset/memcpy/memmove interceptors in asan-rt (in addition to those in the compiler module)
...
llvm-svn: 147319
2011-12-28 19:55:30 +00:00
Kostya Serebryany
46c70d33d7
[asan] make sure __asan_report_* functions are not inlined (so that they are not optimized away and are kept in the resulting library). Patch by glider@google.com
...
llvm-svn: 147302
2011-12-28 00:59:39 +00:00
Kostya Serebryany
dd1386f882
new() has slightly different signature on Android. This patch adds the
...
llvm-svn: 147300
2011-12-27 23:11:09 +00:00
Kostya Serebryany
6d37656c1a
[asan] revert r146529: we do need to build asan-rt as a shared library. Will need to find a different way to modify preinit_array
...
llvm-svn: 146703
2011-12-15 23:08:00 +00:00
Kostya Serebryany
7fb33a3d40
[asan] poison the internal asan heap memory, just in case. Change Printf to Report when debugging globals.
...
llvm-svn: 146663
2011-12-15 17:41:30 +00:00
Kostya Serebryany
9bd5208965
[asan] insert __asan_init into ".preinit_array" section. Linux-only.
...
llvm-svn: 146529
2011-12-14 00:19:03 +00:00
Kostya Serebryany
72fde3727e
[asan] make use-after-return mode more robust: allow to call instrumented functions while reporting an error
...
llvm-svn: 146231
2011-12-09 01:49:31 +00:00
Kostya Serebryany
b50a539eba
[asan] move build-time config options from makefile to source (otherwise we need config options in all makefiles)
...
llvm-svn: 146161
2011-12-08 18:30:42 +00:00
Kostya Serebryany
f0d799a6bc
[asan] fix the error message for 16-byte accesses (it previously printed 'unknown-crash')
...
llvm-svn: 146075
2011-12-07 21:30:20 +00:00
Kostya Serebryany
ca207f0473
[asan] minor cleanup
...
llvm-svn: 145966
2011-12-06 21:10:15 +00:00
Kostya Serebryany
49a182fa12
[asan] always collect malloc statstics (removed FLAG_stats)
...
llvm-svn: 145838
2011-12-05 19:17:53 +00:00
Kostya Serebryany
93927f9e01
[asan] don't require __cxa_throw to be present in the process. This is the last dependency on libstdc++
...
llvm-svn: 145821
2011-12-05 17:56:32 +00:00
Kostya Serebryany
e4bada2c94
[asan] get rid of std::map. No STL and almost no libstdc++ left.
...
llvm-svn: 145706
2011-12-02 21:02:20 +00:00
Kostya Serebryany
2d27cdf621
[asan] minimize the use of STL. One bit is still left.
...
llvm-svn: 145691
2011-12-02 18:42:04 +00:00
Daniel Dunbar
cf7fb02388
build/asan: Better fix for ASAN i386 build on Darwin, this causes us to see the
...
non-standard struct names.
llvm-svn: 145658
2011-12-02 00:52:55 +00:00
Daniel Dunbar
8a5fd211ab
build/asan: Fix ASAN build for i386, for reasons I don't really understand we
...
get the DARWIN_UNIX03 definition on x86_64 but not on i386.
llvm-svn: 145657
2011-12-02 00:45:48 +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
15dd3f2500
Refactor shadow poisoning done by asan-rt, no funtionality changes; patch by samsonov@google.com
...
llvm-svn: 145505
2011-11-30 18:50:23 +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