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