Timur Iskhodzhanov
667cae7b69
[ASan] Remove an unused ChunkBase field
...
Also fix wrong alignment maths and an outdated comment
llvm-svn: 182238
2013-05-20 08:20:17 +00:00
Kostya Serebryany
3469375e4f
[sanitizer] factor out ByteMap from SizeClassAllocator32 so that it can be later replaced with a more memory-efficient implementation on 64-bit.
...
llvm-svn: 182234
2013-05-20 07:29:21 +00:00
Timur Iskhodzhanov
836a4f3643
Replace CHECK(a == b); with CHECK_EQ(a, b); throughout asan_allocator2.cc
...
llvm-svn: 182198
2013-05-18 18:27:33 +00:00
Kostya Serebryany
2b42716213
[asan] fix powerpc build and one test; fix lint
...
llvm-svn: 181881
2013-05-15 12:36:29 +00:00
Sergey Matveev
0c8ed9ce44
[asan] Common flags in ASan.
...
Some flags that are common to ASan/MSan/TSan/LSan have been moved to
sanitizer_common.
llvm-svn: 181193
2013-05-06 11:27:58 +00:00
Kostya Serebryany
eef8bd4355
[asan] nuke the old unused allocator code
...
llvm-svn: 178758
2013-04-04 11:32:49 +00:00
Kostya Serebryany
13b07733b1
[asan] fill first 4K of malloc-ed memory with garbage, implement flags max_malloc_fill_size and malloc_fill_byte
...
llvm-svn: 178757
2013-04-04 11:17:14 +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
Timur Iskhodzhanov
fb74020cea
Revert 177745 as it was incorrect
...
llvm-svn: 177746
2013-03-22 18:16:57 +00:00
Timur Iskhodzhanov
e117eef77f
Band-aid fix for the Windows build caused by r177710. Long-term, atomic_compare_exchange_strong should be a template on Windows too...
...
llvm-svn: 177745
2013-03-22 18:05:28 +00:00
Alexey Samsonov
a5eb3cb721
[ASan] Fix an error on invalid deallocation in ASan allocator. When ASan checks if memory freed by user was indeed previously allocated, it first does an atomic write to presumed location of chunk header. This is wrong, as if the free is invalid, we may overwrite some valuable data (like other fields of the chunk header). Fix this by using atomic_compare_exchange instead.
...
llvm-svn: 177710
2013-03-22 07:40:34 +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
920b3b9a0c
[ASan] Move malloc stats collection away from AsanThreadRegistry class.
...
llvm-svn: 177508
2013-03-20 10:11:24 +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
67b1478914
[asan] use 4Tb of address space for the asan allocator instead of 1Tb. This increases the memory available for a single size class from 16Gb to 64Gb. The total VM footprint becomes 20Tb
...
llvm-svn: 176857
2013-03-12 09:04:49 +00:00
Kostya Serebryany
8ee2a5adc7
[asan] if calloc returns a freshly-mmaped memory, don't clear it with memset. Speeds up calloc-intensive code
...
llvm-svn: 176185
2013-02-27 13:38:19 +00:00
Kostya Serebryany
459df6f167
[asan] a bit stricter lint for CHECK vs CHECK_XX (these CHECK_XX really help debugging!)
...
llvm-svn: 176085
2013-02-26 12:59:06 +00:00
Timur Iskhodzhanov
167f9e4395
[ASan] Switch Windows to allocator v2, also fixing some build errors
...
llvm-svn: 174707
2013-02-08 12:02:00 +00:00
Alexander Potapenko
f444a49310
[ASan] Implement asan_mz_size(), asan_mz_force_lock() and asan_mz_force_unlock() for allocator2.
...
Switch to allocator2 on Darwin.
llvm-svn: 174603
2013-02-07 11:40:03 +00:00
Evgeniy Stepanov
1bc7298c44
[asan] Fix nonsensical reports of partial right OOB.
...
In case of partial right OOB, ASan was reporting
X is located 0 bytes to the right of [A, B)
where X was actually inside [A, B).
With this change, ASan will report B as the error address in such case.
llvm-svn: 174373
2013-02-05 14:32:03 +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
Alexey Samsonov
9aa2e4f5c4
[ASan] fix deallocation hook in allocator2: according to specification, dealloc hook should be called before deallocating memory
...
llvm-svn: 173778
2013-01-29 08:19:11 +00:00
Alexey Samsonov
615b86cf0a
[ASan] Do allocate memory even for zero-size allocation requests. Explain why we have to do this in comments.
...
llvm-svn: 173776
2013-01-29 07:51:34 +00:00
Alexey Samsonov
7eda134fa7
[ASan] fix a bug in allocator-v2 which could lead to SEGV on realloc(malloc(0), 4)
...
llvm-svn: 173681
2013-01-28 11:24:13 +00:00
Kostya Serebryany
61761f182b
[asan] fix a crash in asan stats printing (initialize the allocator in __asan_init)
...
llvm-svn: 173676
2013-01-28 08:05:47 +00:00
Kostya Serebryany
fa79cd65e2
[sanitizer] fix calloc overflow in asan/tsan/msan
...
llvm-svn: 173441
2013-01-25 11:46:22 +00:00
Kostya Serebryany
8f267137c2
[asan] initialize kHighMemEnd at startup (instead of at compile time) to simplify further changes for various address space layouts. Fix asan_allocator2 for PowerPC (tested on 44-bit address space)
...
llvm-svn: 173260
2013-01-23 13:27:43 +00:00
Alexey Samsonov
769af07372
[ASan] fix __asan_get_ownership(p) and __asan_get_allocated_size(p) for the p = malloc(0)
...
llvm-svn: 172717
2013-01-17 13:25:17 +00:00
Kostya Serebryany
b7062cec53
[asan] asan_allocator2: fix the memalign handling (clear the first word of allocated chunk in case there is an old memalign magic)
...
llvm-svn: 172603
2013-01-16 09:12:14 +00:00
Dmitry Vyukov
f5fa4c8a77
asan: weaken memory ordering, it's expensive in current implementation
...
llvm-svn: 172210
2013-01-11 16:02:31 +00:00
Kostya Serebryany
9a7e8ddb21
[asan] fid asan_allocator2 build
...
llvm-svn: 172194
2013-01-11 11:27:42 +00:00
Dmitry Vyukov
008dba6aa0
asan: always pass allocator cache to Allocate()
...
llvm-svn: 172193
2013-01-11 11:15:48 +00:00
Dmitry Vyukov
b1c0dbe2c6
asan: faster quarantine
...
llvm-svn: 172192
2013-01-11 11:03:35 +00:00
Dmitry Vyukov
db0cf871d4
asan: Refactor asan memory quarantine.
...
llvm-svn: 172183
2013-01-11 08:07:43 +00:00
Kostya Serebryany
8cc7b627b4
[asan] asan_allocator2: do less work under the quarantine lock; make the strcasecmp test more resistant to the contents of unaddressable memory
...
llvm-svn: 172048
2013-01-10 09:25:16 +00:00
Kostya Serebryany
4a42cf69a6
[sanitizer] add statistics to the allocator; fix lint
...
llvm-svn: 171161
2012-12-27 14:09:19 +00:00
Kostya Serebryany
6f604b5007
[asan/tsan] when unmapping a chunk of user memory, apply madvise(MADV_DONTNEED) to the corresponding chunk of shadow memory. Also update sanitizer_allocator64_testlib.cc
...
llvm-svn: 171144
2012-12-27 07:37:24 +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
35cc75876a
[asan] asan_allocator2: implement adaptive redzones. Now with asan_allocator2 allocations <= 48 bytes have 16 byte redzone, allocations of 48-96 bytes -- have 32 bytes redzone, etc (max redzone is 2048). If ASAN_OPTIONS=redzone=n is set, it changes the minimal redzone size
...
llvm-svn: 171107
2012-12-26 10:41:24 +00:00
Kostya Serebryany
a11cd57a78
[asan] asan_allocator2: by default use the StackDepot to store the stack traces instead of storing them in the redzones
...
llvm-svn: 171099
2012-12-26 06:30:02 +00:00
Kostya Serebryany
27ad15e165
[asan] asan_allocator2: store the user requested size in just 32 bits (larger sizes use metadata). This allows to put one more 32-bit field into the chunk header
...
llvm-svn: 171089
2012-12-26 04:52:07 +00:00
Kostya Serebryany
eff9b4b9b1
[asan] add a test for right OOB with special large sizes. Fix this test in asan_allocator2. More test tweaking for allocator2
...
llvm-svn: 171058
2012-12-25 09:40:20 +00:00
Kostya Serebryany
fe80f080ee
[asan] asan_allocator2 fix two asserts that happen on full chrome: a) memalign called with 0 size and large alignment and b) malloc called after TSD has been destructed
...
llvm-svn: 170900
2012-12-21 14:54:46 +00:00
Kostya Serebryany
3cc719fdf9
[asan] asan_allocator2: better memory stats
...
llvm-svn: 170888
2012-12-21 12:26:31 +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
c0d8ca5537
[asan] asan_allocator2: implement memalign
...
llvm-svn: 170697
2012-12-20 14:35:06 +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
ab8d33184d
[asan] asan_allocator2: make all remaining tests pass.
...
llvm-svn: 170680
2012-12-20 08:53:41 +00:00
Kostya Serebryany
dcdeecb257
[asan] asan_allocator2: add mmap/munmap stats
...
llvm-svn: 170548
2012-12-19 14:56:38 +00:00
Kostya Serebryany
479f05b276
[asan] asan_allocator2: improve FindHeapChunkByAddress to find memory chunks to the left of a given address. Almost all tests pass with the new allocator now, only 6 are left to fix.
...
llvm-svn: 170511
2012-12-19 08:32:50 +00:00