1 //===-- sanitizer_mac_libcdep.cc ------------------------------------------===// 2 // 3 // This file is distributed under the University of Illinois Open Source 4 // License. See LICENSE.TXT for details. 5 // 6 //===----------------------------------------------------------------------===// 7 // 8 // This file is shared between various sanitizers' runtime libraries and 9 // implements OSX-specific functions. 10 //===----------------------------------------------------------------------===// 11 12 #include "sanitizer_platform.h" 13 #if SANITIZER_MAC 14 #include "sanitizer_mac.h" 15 16 #include <sys/mman.h> 17 18 namespace __sanitizer { 19 RestrictMemoryToMaxAddress(uptr max_address)20void RestrictMemoryToMaxAddress(uptr max_address) { 21 uptr size_to_mmap = GetMaxVirtualAddress() + 1 - max_address; 22 void *res = MmapFixedNoAccess(max_address, size_to_mmap, "high gap"); 23 CHECK(res != MAP_FAILED); 24 } 25 26 } // namespace __sanitizer 27 28 #endif // SANITIZER_MAC 29