Alexey Samsonov
0ac73fc9f8
AddressSanitizer: return false instead of true for __asan_get_ownership(NULL)
...
llvm-svn: 148394
2012-01-18 15:26:55 +00:00
Alexander Potapenko
38da9a04f5
Delete sysinfo/* and all references to it.
...
llvm-svn: 148386
2012-01-18 11:42:30 +00:00
Alexander Potapenko
4257386879
Implement AsanProcMaps for Mac OS. The code from sysinfo/ is not needed anymore and should be cleaned up.
...
llvm-svn: 148385
2012-01-18 11:16:05 +00:00
Kostya Serebryany
5767f0f113
[asan] workaround for bug http://llvm.org/bugs/show_bug.cgi?id=11763 . Do not bark on memcpy(a, a, size).
...
llvm-svn: 148318
2012-01-17 18:43:52 +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
Alexey Samsonov
67d508d083
Revert commit 148304
...
llvm-svn: 148305
2012-01-17 14:01:15 +00:00
Alexey Samsonov
1e310295d0
AddressSanitizer: from this patch, ASan allocator returns false for __asan_get_ownership(NULL) and produce error reports for malloc_usable_size(NULL) and __asan_get_allocated_size(NULL)
...
llvm-svn: 148304
2012-01-17 13:31:54 +00:00
Alexander Potapenko
2b2e0721d7
Define the bounds of the branch allocator memory space for 32-bit apps.
...
llvm-svn: 148303
2012-01-17 09:38:54 +00:00
Alexey Samsonov
209c514a1d
AddressSanitizer: add support for malloc_usable_size() function
...
llvm-svn: 148287
2012-01-17 06:39:10 +00:00
Alexey Samsonov
2d3a67b73b
AddressSanitizer: create AsanThreadSummary together with AsanThread (in parent thread)
...
llvm-svn: 148286
2012-01-17 06:35:31 +00:00
Evgeniy Stepanov
1b65b17bf5
[asan] Implement GetObjectNameAndOffset on ARM.
...
llvm-svn: 148236
2012-01-16 12:45:07 +00:00
Alexey Samsonov
50bf956f29
AddressSanitizer: fix recently introduced lint errors and broken test on Mac.
...
llvm-svn: 148235
2012-01-16 12:38:09 +00:00
Evgeniy Stepanov
2227207c83
Disable posix_memalign test on Android.
...
llvm-svn: 148234
2012-01-16 12:19:51 +00:00
Alexander Potapenko
bd53f597de
This patch adds two methods, __asan_allocate_island and __asan_deallocate_island
...
and switches our interceptors to using them instead of the default
vm_allocate-based approach used by mach_override_ptr.
To simplify the code, a fixed memory mapping is used for the allocation pool --
note that we can't mmap an arbitrary chunk of memory, because the shadow memory hasn't been mapped yet
(for the reasons discussed in http://code.google.com/p/address-sanitizer/issues/detail?id=24 , we cannot map the shadow earlier)
The patch drops the program startup time from several second to half a second,
which speeds up the execution of ASan tests noticeably.
Because of the virtual memory size occupied by the programs it's hard
to speed up the shutdown time, which would've also helped the tests.
llvm-svn: 148116
2012-01-13 16:13:58 +00:00
Alexander Potapenko
9301db4baa
Add __asan_mach_override_ptr_custom, which allows to inject a custom memory allocator into mach_override_ptr().
...
llvm-svn: 148115
2012-01-13 15:31:37 +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
Alexey Samsonov
5d5fa5115a
Test commit. Minor cleanup in AsanThread
...
llvm-svn: 147930
2012-01-11 08:07:51 +00:00
Kostya Serebryany
41cdb8614c
[asan] remove OS-dependent headers from asan_internal.h
...
llvm-svn: 147919
2012-01-11 02:39:16 +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
1dd51b53b2
[asan] move TSD code into asan_posix.cc
...
llvm-svn: 147913
2012-01-11 02:21:06 +00:00
Kostya Serebryany
332923be32
[asan] get rid of the scary TSD destructor code. Now, we store the leaky AsanThreadSummary in TSD and never remove it from there.
...
llvm-svn: 147910
2012-01-11 02:03:16 +00:00
Kostya Serebryany
258d7b4182
[asan] hopefully fix the build on MacOS 10.6 (the code did work on 10.7, where I tested it)
...
llvm-svn: 147896
2012-01-10 23:36:59 +00:00
Kostya Serebryany
a82f0d4950
[asan] move OS-dependent code away from asan_lock.h
...
llvm-svn: 147878
2012-01-10 21:24: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
3a55cfacf1
[asan] temporary reinstate string.h/strings.h. Removal of those caused a Mac build failulre which I failed to observe before the commit
...
llvm-svn: 147810
2012-01-09 22:45:05 +00:00
Kostya Serebryany
d9cb2f13b3
[asan] don't include string.h and strings.h
...
llvm-svn: 147809
2012-01-09 22:36:51 +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
3ab81d1f26
[asan] fix mac build once more
...
llvm-svn: 147796
2012-01-09 19:50:06 +00:00
Kostya Serebryany
3e559e87a4
[asan]: fix typo from previous commit
...
llvm-svn: 147793
2012-01-09 19:41:15 +00:00
Kostya Serebryany
ba41e8d2c5
[asan]: fix mac build
...
llvm-svn: 147792
2012-01-09 19:35:11 +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
3b7fb102c4
[asan] use dl_iterate_phdr for pre-symbolization on linux instead of parsing /proc/self/maps
...
llvm-svn: 147628
2012-01-05 23:50:34 +00:00
Kostya Serebryany
78d87d3b4b
[asan] move {linux,mac}-specific code from asan_thread.cc to asan_{linux,mac}.cc; also add asan_procmaps.h which I forgot to add on previous commit.
...
llvm-svn: 147586
2012-01-05 01:07:27 +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
cc1d7893d6
[asan] remove objdump-based tests in favour of much simpler LLVM-ish tests
...
llvm-svn: 147514
2012-01-04 02:08:46 +00:00
Kostya Serebryany
10a6b304e1
[asan] build asan-rt with -funwind-tables
...
llvm-svn: 147341
2011-12-29 17:29:20 +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
5bdf7dcb2d
[asan] missing PTHREAD_DESTRUCTOR_ITERATIONS on Android. patch by eugeni.stepanov@gmail.com
...
llvm-svn: 147322
2011-12-28 20:47:21 +00:00
Kostya Serebryany
bab78de8a3
[asan] discover main thread stack limits without pthread. patch by eugeni.stepanov@gmail.com
...
llvm-svn: 147321
2011-12-28 20:34:30 +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
e4a84c4f1f
[asan] better message for parameter overlap bugs
...
llvm-svn: 147317
2011-12-28 19:24:31 +00:00
Kostya Serebryany
50bc2a71b2
[asan] interceptor for strcat. Patch by samsonov@google.com
...
llvm-svn: 147316
2011-12-28 19:08:49 +00:00
Kostya Serebryany
6579e355c0
[asan] interceptor for memcmp. Patch by samsonov@google.com
...
llvm-svn: 147315
2011-12-28 18:56:42 +00:00
Kostya Serebryany
809632e28e
[asan] interceptors for strcasecmp and strncasecmp. patch by samsonov@google.com
...
llvm-svn: 147304
2011-12-28 02:24:50 +00:00
Kostya Serebryany
8b981c2564
The code instrumented with ASan may have its own instance of the
...
mach_override library.
In this case chances are that functions from it will be called from
mach_override_ptr() during ASan initialization.
This may lead to crashes (if those functions are instrumented) or
incorrect behavior (if the implementations differ).
The attached patch renames mach_override_ptr() into
__asan_mach_override_ptr() and makes the rest of the mach_override
internals hidden.
The corresponding AddressSanitizer bug is
http://code.google.com/p/address-sanitizer/issues/detail?id=22
Patch by glider@google.com
llvm-svn: 147303
2011-12-28 01:08:14 +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
5469986da0
[asan] remove the test for cfree. 'man cfree' says: 'This function should never be used.' and this function is not found on many OSes we support.
...
llvm-svn: 147301
2011-12-27 23:42:55 +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
db32f967b9
[asan] rely on __has_feature(address_sanitizer) instead of the ADDRESS_SANITIZER macro
...
llvm-svn: 147297
2011-12-27 21:57:12 +00:00
Kostya Serebryany
1b82c281f3
[asan] make sure frame pointers are not omitted when running asan output tests
...
llvm-svn: 147293
2011-12-27 19:52:54 +00:00
Kostya Serebryany
6bb2f1d5b5
Recently the GCD tests started failing because of the invalid size of
...
FakeStack on the worker threads.
This patch moves the AsanThread initialization into a separate
procedure that's called when AsanThread objects are called for worker
threads.
Patch by glider@google.com
llvm-svn: 146752
2011-12-16 19:13:35 +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
7ce9686921
[asan] added a test to check that a global-buffer-overflow mentioned the module name; revert incorrect change in the test runner
...
llvm-svn: 146701
2011-12-15 22:57:32 +00:00
Kostya Serebryany
9366d42e91
[asan] fix a bug (issue 19) where dlclose and the following mmap caused a false positive. run-time part.
...
llvm-svn: 146687
2011-12-15 21:55:34 +00:00
Kostya Serebryany
e8a7d2aef8
[asan] regression test for asan issue 19, currently fails.
...
llvm-svn: 146681
2011-12-15 20:38:14 +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
e85da73553
[asan] fix the test runner to detect build breakages; add a test for -pie
...
llvm-svn: 146528
2011-12-14 00:05:22 +00:00
Kostya Serebryany
1d337a5e06
[asan] fix some more format warnings in sysinfo/sysinfo.cc
...
llvm-svn: 146526
2011-12-13 23:34:59 +00:00
Kostya Serebryany
d47a91ad2a
[asan] canonicalise the output for double-free and wrong-free. fixes asan issue 18
...
llvm-svn: 146501
2011-12-13 19:16:36 +00:00
Kostya Serebryany
0698b852ed
[asan] fix asan-rt interceptors on Snow Leopard. Patch by glider@google.com
...
llvm-svn: 146263
2011-12-09 18:18:54 +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
7487a0ae1f
[asan] fix output test to not require debug symbols in asan run-time
...
llvm-svn: 146212
2011-12-09 00:18:21 +00:00
Kostya Serebryany
7c01c1af19
[asan] better test for use-after-return mode
...
llvm-svn: 146203
2011-12-08 23:30:48 +00:00
Kostya Serebryany
9b5673cf5a
[asan] fresh version of mach_override; added mach_override/README.txt. Patch by glider@google.com
...
llvm-svn: 146166
2011-12-08 19:14:07 +00:00
Kostya Serebryany
9752158954
[asan] update the soon-to-be-depricated asan makefile to use the new path for asan-rt (affects only linux)
...
llvm-svn: 146162
2011-12-08 18:46:33 +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
8b815e1a08
[asan] GCD tests on Mac: prevent optimization and enable. Patch by glider@google.com
...
llvm-svn: 145953
2011-12-06 19:10:48 +00:00
Kostya Serebryany
8b277533b6
[asan] remove format warnings in sysinfo/sysinfo.cc
...
llvm-svn: 145886
2011-12-06 01:08:31 +00:00
Kostya Serebryany
ab7940f6e1
[asan]: test a pure C file with -faddress-sanitizer; lint fixes
...
llvm-svn: 145848
2011-12-05 20:44:30 +00:00
Kostya Serebryany
0e069e2aa9
[asan] add the test for bug 11468
...
llvm-svn: 145839
2011-12-05 19:20:57 +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
92ebcadfe4
[asan] cleanup memset/memmove/memcpy interceptors and enable them on Mac. Patch by samsonov@google.com
...
llvm-svn: 145826
2011-12-05 18:56:29 +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
551a1739b8
[asan] get rid of some more dependency on libstdc++
...
llvm-svn: 145743
2011-12-03 02:23:25 +00:00
Kostya Serebryany
26c5df4733
[asan] micro-benchmark for use-after-return fake stack
...
llvm-svn: 145739
2011-12-03 01:44:48 +00:00
Kostya Serebryany
b89f2a6e78
[asan] put back -O2 which was lost quite some time ago and caused noticeable perf drop in malloc-intensive apps. doh.
...
llvm-svn: 145723
2011-12-02 23:04:12 +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
c5be44aaa2
[asan] quick fix for mac build, second attempt. Sorry for spam.
...
llvm-svn: 145694
2011-12-02 18:52:35 +00:00
Kostya Serebryany
196cd6af90
[asan] quick fix for mac build
...
llvm-svn: 145692
2011-12-02 18:48: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
2003d39f7c
build: Add ModuleName per-subdir variable as a way to organize the different
...
sets of functions/objects into high level groups. Currently we have "builtins"
(the main compiler-rt code), "profile", and "asan".
- Use this to define CommonFunctions and ArchFunctions to only reference the
builtins functions.
llvm-svn: 145674
2011-12-02 02:42:07 +00:00
Daniel Dunbar
4e3a11ba57
lib/asan: Fix possible type mismatches.
...
llvm-svn: 145664
2011-12-02 01:36:38 +00:00
Daniel Dunbar
9c665e36d4
lib/asan: Attempt to ensure __WORDSIZE gets defined, it is not always set by
...
Darwin's stdint.h for example.
llvm-svn: 145663
2011-12-02 01:32:27 +00:00
Kostya Serebryany
70e163b507
add/update LICENSE.TXT files for the third_party code used by asan
...
llvm-svn: 145659
2011-12-02 01:12:36 +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
Daniel Dunbar
12024d00a7
asan: Fill in integration with compiler-rt/make build.
...
llvm-svn: 145648
2011-12-01 23:35:56 +00:00
Daniel Dunbar
5dc7770bf7
asan: Suppress a -Wbitwise-op-parentheses.
...
llvm-svn: 145647
2011-12-01 23:35:51 +00:00
Daniel Dunbar
fc4a4a3cbc
asan: #if 0 out some unused functions (we build with -Werror).
...
llvm-svn: 145645
2011-12-01 23:35:47 +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
f318e29102
test asan at -O0
...
llvm-svn: 145532
2011-11-30 22:27:30 +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
9d1eee9e2a
fix asan-rt build on Mac. Patch by glider@google.com
...
llvm-svn: 145496
2011-11-30 17:33:13 +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