Alexey Samsonov
e0e31c4a30
[ASan] Clarify that AsanThread objects are allocated only via mmap(). No functionality change.
...
llvm-svn: 195840
2013-11-27 13:22:21 +00:00
Kostya Serebryany
04a1767a2e
[asan] fix a leak in tds ( https://code.google.com/p/address-sanitizer/issues/detail?id=233 )
...
llvm-svn: 194572
2013-11-13 13:27:44 +00:00
Peter Collingbourne
50cb32e614
Introduce an operator new for LowLevelAllocator, and convert most users to it.
...
llvm-svn: 193308
2013-10-24 06:23:39 +00:00
Kostya Serebryany
f11e485d60
[asan] allocate AsanThreadContext using LowLevelAllocator instead of mmap to save space
...
llvm-svn: 192980
2013-10-18 15:07:07 +00:00
Kostya Serebryany
9628839869
[asan] reduce the size of AsanThreadContext by storing the stack trace in the stack depot
...
llvm-svn: 192979
2013-10-18 14:50:44 +00:00
Dmitry Vyukov
52ca74ec61
tsan: move verbosity flag to CommonFlags
...
llvm-svn: 192701
2013-10-15 13:28:51 +00:00
Sergey Matveev
43d90cbd86
[lsan] Support ASan's stack-use-after-return mode in LSan.
...
Treat the fake stack as live memory.
llvm-svn: 192593
2013-10-14 14:04:50 +00:00
Sergey Matveev
da9f5e7e7f
[asan] Improve thread lifetime tracking on POSIX systems.
...
Call AsanThread::Destroy() from a late-running TSD destructor.
Previously we called it before any user-registered TSD destructors, which caused
false positives in LeakSanitizer.
llvm-svn: 192585
2013-10-14 12:01:05 +00:00
Kostya Serebryany
3c42ce1516
[asan] introduce run-time flag uar_stack_size_log to control the size of FakeStack; don't crash when the fake stack is exhausted, move some code to .cc file
...
llvm-svn: 191510
2013-09-27 11:37:23 +00:00
Kostya Serebryany
f8bbdfaf95
[asan] fix one more async-signal-safety issue with use-after-return
...
llvm-svn: 191004
2013-09-19 14:59:52 +00:00
Kostya Serebryany
c3d43ca3ec
[asan] add a run-time option detect_stack_use_after_return, add verbosity output for fake stack
...
llvm-svn: 190932
2013-09-18 10:35:12 +00:00
Kostya Serebryany
43c4493b44
[asan] second attempt to use TLS with fake stack. This time it looks (more) async-signal safe.
...
llvm-svn: 190663
2013-09-13 06:32:26 +00:00
Kostya Serebryany
44441cc34b
[asan] (part 2) don't lazy-init fake_stack if we only need to check that fake_stack exists (should fix 32-bit builds)
...
llvm-svn: 190594
2013-09-12 08:47:00 +00:00
Kostya Serebryany
736bd08e05
[asan] don't lazy-init fake_stack if we only need to check that fake_stack exists (should fix 32-bit builds)
...
llvm-svn: 190593
2013-09-12 08:43:44 +00:00
Kostya Serebryany
628cda7367
[asan] hopefully make the FakeStack async-signal safe, enable the related test
...
llvm-svn: 190592
2013-09-12 08:34:50 +00:00
Alexey Samsonov
4b16885839
Improve collecting malloc stats in ASan
...
Summary:
This change makes races between updates of thread-local stats and
merging all the thread-local stats together less harmful.
Reviewers: kcc
Reviewed By: kcc
CC: dvyukov, llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1572
llvm-svn: 189744
2013-09-02 08:39:07 +00:00
Sergey Matveev
bdeff959a1
[lsan] Handle fork() correctly.
...
Update the main thread's os_id on every pthread_create, and before
initiating leak checking. This ensures that we have the correct os_id even if we
have forked after Init().
llvm-svn: 185815
2013-07-08 12:57:24 +00:00
Kostya Serebryany
6a068a715d
[asan] initialize fake_stack lazily and increase its maximal size. This makes -fsanitize=address,use-after-return more robust: all SPEC tests pass now. In the default mode thread stacks become a bit smaller.
...
llvm-svn: 184934
2013-06-26 12:16:05 +00:00
Sergey Matveev
b94d5e2d1c
[asan] Move lsan_disabled out of thread context.
...
Fix for the case where disabler is used in pthread key destructor.
llvm-svn: 184553
2013-06-21 14:51:52 +00:00
Timur Iskhodzhanov
baf90ccfac
Fix ALIGNED misuse in asan_thread.cc (built on all platforms); also, add a comment to the ALIGNED macro describing the correct usage
...
llvm-svn: 183214
2013-06-04 08:25:17 +00:00
Kostya Serebryany
c1aa0e8f69
[asan] ASan Linux MIPS32 support (compiler-rt part), patch by Jyun-Yan Y
...
llvm-svn: 183105
2013-06-03 14:49:25 +00:00
Sergey Matveev
17ee1abfa7
[lsan] Add __lsan_disable() and __lsan_enable().
...
Objects allocated after a call to __lsan_disable() will be treated as
live memory. Also add a ScopedDisabler.
llvm-svn: 183099
2013-06-03 11:21:34 +00:00
Sergey Matveev
09886cd17a
[asan] Make ASan report the correct thread address ranges to LSan.
...
This CL enables thread support in LSan when used on top of ASan.
llvm-svn: 182854
2013-05-29 13:09:44 +00:00
Sergey Matveev
65dd62abe5
[asan] LSan hooks in asan_thread.cc
...
llvm-svn: 182378
2013-05-21 13:40:13 +00:00
Kostya Serebryany
5b4267f7e7
[sanitizer] found a bug by code inspection: CHECK(a=b) instead of CHECK(a==b). Was puzzled why lint did not catch it. Turns out this check was disabled for asan source. fix all cases and enable the check
...
llvm-svn: 178872
2013-04-05 14:40:25 +00:00
Alexey Samsonov
a88c60b085
[ASan] Speed-up initialization-order checking: create and use fast versions of PoisonShadow functions, store copies of __asan_global descriptors in a vector instead of list of pointers. This gives 3x speedup on both benchmarks and real binaries with lots of globals.
...
llvm-svn: 178239
2013-03-28 15:42:43 +00:00
Kostya Serebryany
667a34a120
[asan] Change the way we report the alloca frame on stack-buff-overflow.
...
Before: the function name was stored by the compiler as a constant string
and the run-time was printing it.
Now: the PC is stored instead and the run-time prints the full symbolized frame.
This adds a couple of instructions into every function with non-empty stack frame,
but also reduces the binary size because we store less strings (I saw 2% size reduction).
This change bumps the asan ABI version to v3.
compiler-rt part, llvm part will follow.
Example of report (now):
==31711==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffa77cf1c5 at pc 0x41feb0 bp 0x7fffa77cefb0 sp 0x7fffa77cefa8
READ of size 1 at 0x7fffa77cf1c5 thread T0
#0 0x41feaf in Frame0(int, char*, char*, char*) stack-oob-frames.cc:20
#1 0x41f7ff in Frame1(int, char*, char*) stack-oob-frames.cc:24
#2 0x41f477 in Frame2(int, char*) stack-oob-frames.cc:28
#3 0x41f194 in Frame3(int) stack-oob-frames.cc:32
#4 0x41eee0 in main stack-oob-frames.cc:38
#5 0x7f0c5566f76c (/lib/x86_64-linux-gnu/libc.so.6+0x2176c)
#6 0x41eb1c (/usr/local/google/kcc/llvm_cmake/a.out+0x41eb1c)
Address 0x7fffa77cf1c5 is located in stack of thread T0 at offset 293 in frame
#0 0x41f87f in Frame0(int, char*, char*, char*) stack-oob-frames.cc:12 <<<<<<<<<<<<<< this is new
This frame has 6 object(s):
[32, 36) 'frame.addr'
[96, 104) 'a.addr'
[160, 168) 'b.addr'
[224, 232) 'c.addr'
[288, 292) 's'
[352, 360) 'd'
llvm-svn: 177723
2013-03-22 10:36:24 +00:00
Dmitry Vyukov
a7e42b5be5
asan: fix lint warning about line length
...
llvm-svn: 177709
2013-03-22 07:29:59 +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
Alexey Samsonov
cf025cb2e6
[ASan] Move GetCurrentThread/SetCurrentThread from AsanThreadRegistry class into plain functions: they don't actually use registry
...
llvm-svn: 177501
2013-03-20 09:23:28 +00:00
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