1// RUN: %clang_esan_frag -O0 %s -o %t 2>&1 2// RUN: %env_esan_opts=verbosity=1 %run %t 2>&1 | FileCheck %s 3 4#include <unistd.h> 5#include <sys/mman.h> 6#include <stdio.h> 7 8int main(int argc, char **argv) { 9 void *Map = mmap((void *)0x0000016000000000ULL, 0x1000, PROT_READ, 10 MAP_ANON|MAP_PRIVATE|MAP_FIXED, -1, 0); 11 if (Map == (void *)-1) 12 fprintf(stderr, "map failed\n"); 13 else 14 fprintf(stderr, "mapped %p\n", Map); 15 Map = mmap((void *)0x0000016000000000ULL, 0x1000, PROT_READ, 16 MAP_ANON|MAP_PRIVATE, -1, 0); 17 fprintf(stderr, "mapped %p\n", Map); 18 // CHECK: in esan::initializeLibrary 19 // (There can be a re-exec for stack limit here.) 20 // CHECK: Shadow scale=2 offset=0x440000000000 21 // CHECK-NEXT: Shadow #0: [110000000000-114000000000) (256GB) 22 // CHECK-NEXT: Shadow #1: [124000000000-12c000000000) (512GB) 23 // CHECK-NEXT: Shadow #2: [148000000000-150000000000) (512GB) 24 // CHECK-NEXT: mmap conflict: {{.*}} 25 // CHECK-NEXT: map failed 26 // CHECK-NEXT: mmap conflict: {{.*}} 27 // CHECK-NEXT: mapped {{.*}} 28 // CHECK-NEXT: in esan::finalizeLibrary 29 return 0; 30} 31