just done few architecture dependent code
Corresponding LLVM patch - http://reviews.llvm.org/D6165
Details
Diff Detail
Event Timeline
Again, I'll let Kostya sign this off. I'm generally fine with this change as long as it really fixes MIPS and you plan to support MIPS port.
lib/asan/asan_allocator.h | ||
---|---|---|
107 ↗ | (On Diff #15545) | Is this enough? |
lib/sanitizer_common/sanitizer_printf.cc | ||
115 | I'd like to move this logic to sanitizer_common/sanitizer_platform.h. Define something like SANITIZER_POINTER_FORMAT_LENGTH there and |
lib/asan/asan_allocator.h | ||
---|---|---|
107 ↗ | (On Diff #15545) |
I can't answer the 'Is this enough?' question but at the moment the biggest machines we have available to test on have 8GB RAM. It seems reasonable to predict that there will be >32GB machines in the not too distant future though. One other thing to mention is that I've just found out that MIPS64r1 is limited to 36-bit physical addresses (64GB). MIPS64r2 added an extension to provide (up to) 59-bit physical addresses. On both architectures, there is a 64-bit virtual address space of which half is for the kernel and half is for user applications. |
lib/asan/asan_allocator.h | ||
---|---|---|
107 ↗ | (On Diff #15545) | The way SanitizerAllocator64 is designed it will not work with 36-bit physical addresses. 59-bit physical addresses should be more than enough to use SanitizerAllocator64 |
@kcc: As mentioned here[1], whether 16TB of memory is must for asan64 ?
Because test-cases in compiler-rt are working fine.
Now I am planning to build some big application with asan which require GBs of memory.
[1] http://clang.llvm.org/docs/AddressSanitizer.html#limitations
16Tb is the limit for the 47-bit address space in x86_64 -- asan requires that much AS for the shadow.
It also requires 4Tb for the allocator, so on x86_64 the current requirement is 20Tb.
With another address space the limits will be different.
Because test-cases in compiler-rt are working fine.
Now I am planning to build some big application with asan which require GBs of memory.
No need to try a large app.
Write a test that allocates (and does not deallocate) 32-byte chunks in an infinite loop and see how much RAM it can allocate.
[1] http://clang.llvm.org/docs/AddressSanitizer.html#limitations
@kcc: with top command I can see that address sanitized application can allocate VIRT(virtual memory) upto 1TB before exiting .
This is not what I suggested. Please run the following program:
#include <stdio.h>
volatile void *sink;
int main() {
const size_t kSize = 24; for (size_t i = 0; ; i++) { if ((i & (i - 1)) == 0) printf("Allocated %zd chunks of %zd bytes, total %zd Mb\n", i, kSize, (i * kSize) >> 20); char *x = new char[kSize]; x[i % kSize] = 42; sink = x; }
}
clang++ -fsanitize=address malloc_loop.cc && ./a.out
With the current settings on x86_64 it will exhaust all RAM on my machine before dying.
If I set kAllocatorSize to 0x4000000000ULL (minimal allowed) the program will fail like this:
...
Allocated 33554432 chunks of 24 bytes, total 768 Mb
Allocated 67108864 chunks of 24 bytes, total 1536 Mb
AddressSanitizer: Out of memory. Dying. The process has exhausted 4096MB for size class 48.
You don't want you program to die after allocating ~3Gb of memory.
Yet again, SanitizerAllocator64 is not designed to support 36-bit address space, just use SanitizerAllocator32
I got same output as you posted above. I tested it on mips64.
...
Allocated 16777216 chunks of 24 bytes, total 384 Mb
Allocated 33554432 chunks of 24 bytes, total 768 Mb
Allocated 67108864 chunks of 24 bytes, total 1536 Mb
AddressSanitizer: Out of memory. Dying. The process has exhausted 4096MB for size class 48.
Which proves my point. Don't use SanitizerAllocator64 unless you have at least ~46 bits of address space.
Check SANITIZER_CAN_USE_ALLOCATOR64 in sanitizer_common/sanitizer_platform.h
using SanitizerAllocator32 instead of SanitizerAllocator64 for mips64 as its address space is just 40-bit
The output of malloc_loop.cc:
...
Allocated 16777216 chunks of 24 bytes, total 384 Mb
Allocated 33554432 chunks of 24 bytes, total 768 Mb
Allocated 67108864 chunks of 24 bytes, total 1536 Mb
Killed
r221800.
lib/sanitizer_common/sanitizer_platform.h | ||
---|---|---|
115 | This needs to be "8,12", not "12,8" |
This needs to be "8,12", not "12,8"
Please make sure your patches pass testing (check-all) on x86_64 Linux: