Kostya Serebryany
63c36bbe5e
[asan] fix two off-by-one errors that seem to affect only PowerPC because only there the stack top may be equal to the address space top. Noted by Andreas Schwab in http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55975#c11 . Also make swapcontext interceptor a bit more robust
...
llvm-svn: 172807
2013-01-18 11:30:36 +00:00
Kostya Serebryany
f22c697f58
[asan] get rid of some of the uses of kPageSize. The intent is to get rid of it completely to support platforms with multiple possible page sizes.
...
llvm-svn: 168517
2012-11-23 15:38:49 +00:00
Kostya Serebryany
734f1eb5f4
[asan/tsan] do not use __WORDSIZE macro, as it is glibc-private thing. Instead, define our own SANITIZER_WORDSIZE
...
llvm-svn: 168424
2012-11-21 12:38:58 +00:00
Alexander Potapenko
bcc00a4174
[ASan] Revert r168040 and r168043 and take a cleaner solution suggested by Kostya: return the known frame name for fake stack instead of looking it up.
...
llvm-svn: 168046
2012-11-15 15:24:42 +00:00
Alexander Potapenko
93dcc8d2bd
[ASan] Minor fix: return to the last byte of the fake stack if we've raced by.
...
llvm-svn: 168043
2012-11-15 14:59:19 +00:00
Alexander Potapenko
b34db9e883
[ASan] Poison the leftmost shadow byte with a special value so that we can find
...
the beginning of the fake frame when reporting an use-after-return error.
Fixes http://code.google.com/p/address-sanitizer/issues/detail?id=126
llvm-svn: 168040
2012-11-15 13:40:44 +00:00
Kostya Serebryany
f9caa28ccf
[asan] increase max stack size to 256 (+test)
...
llvm-svn: 163308
2012-09-06 10:57:03 +00:00
Kostya Serebryany
6b0d775229
[asan] some renaming before we move StackTrace into sanitizer_common
...
llvm-svn: 162747
2012-08-28 11:54:30 +00:00
Alexey Samsonov
e67a5dd8e1
[Sanitizer] Use low-level allocator in flag parsing to avoid calling malloc() before ASan/TSan initialization is done
...
llvm-svn: 162673
2012-08-27 14:04:54 +00:00
Alexander Potapenko
51e6488b31
Intercept CFAllocator for each thread in the program.
...
Test that child threads use the ASan allocator, that allocated memory can be passed to another thread and deallocated on it.
This should fix http://code.google.com/p/address-sanitizer/issues/detail?id=81
llvm-svn: 160630
2012-07-23 14:07:58 +00:00
Kostya Serebryany
78713bc574
[asan] get rid of the last operator new call in asan rtl
...
llvm-svn: 160347
2012-07-17 07:20:13 +00:00
Alexey Samsonov
34efb8e9b9
[ASan] Use common flags parsing machinery.
...
llvm-svn: 159933
2012-07-09 14:36:04 +00:00
Alexey Samsonov
52f946611f
[ASan] don't include deleted header
...
llvm-svn: 158448
2012-06-14 13:15:45 +00:00
Alexey Samsonov
4b1f1031e6
[Sanitizer] factor out GetThreadStackTopAndBottom from ASan runtime to common.
...
llvm-svn: 158140
2012-06-07 07:13:46 +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
Kostya Serebryany
79437fe376
[asan] make tid u32 instead of int
...
llvm-svn: 158074
2012-06-06 15:06:58 +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
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
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
Evgeniy Stepanov
d989be1386
Fix GetFrameNameByAddr hitting stale stack guards.
...
In the current implementation AsanThread::GetFrameNameByAddr scans the
stack for a magic guard value to locate base address of the stack
frame. This is not reliable, especially on ARM, where the code that
stores this magic value has to construct it in a register from two
small intermediates; this register can then end up stored in a random
stack location in the prologue of another function.
With this change, GetFrameNameByAddr scans the shadow memory for the
signature of a left stack redzone instead. It is now possible to
remove the magic from the instrumentation pass for additional
performance gain. We keep it there for now just to make sure the new
algorithm does not fail in some corner case.
llvm-svn: 156710
2012-05-12 12:33:10 +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
Timur Iskhodzhanov
0f9c9a5332
[ASan] Intercept CreateThread on Windows
...
llvm-svn: 151366
2012-02-24 15:28:43 +00:00
Kostya Serebryany
b5eb5a7a05
[asan] make sure the AsanThread object is destroyed if pthread_exit is called
...
llvm-svn: 149940
2012-02-07 00:27:15 +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
Alexey Samsonov
5d5fa5115a
Test commit. Minor cleanup in AsanThread
...
llvm-svn: 147930
2012-01-11 08:07:51 +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
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
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
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
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
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
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
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