[PATCH] [asan] [mips] added support of asan for mips64/mips64el

Kostya Serebryany kcc at google.com
Fri Nov 7 11:15:26 PST 2014


>>! In D6024#15, @kumarsukhani wrote:
> @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

http://reviews.llvm.org/D6024






More information about the llvm-commits mailing list