summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_posix_libcdep.cc
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2016-04-22 01:08:54 +0000
committerKostya Serebryany <kcc@google.com>2016-04-22 01:08:54 +0000
commit6b7dd03a7b30bb2c8f42a337cf5dc492a3171187 (patch)
tree7649cc9902b7ec6efeac1891f6363bfea38681e6 /lib/sanitizer_common/sanitizer_posix_libcdep.cc
parent86ee12b54eff8049bde70a56e1ee850eb6726ed0 (diff)
[sanitizer] Allow the sanitizer allocator to use a non-fixed address range. An allocator with a non-fixed address range will be attack-resistan. NFC for the sanitizers at this point.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267094 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_posix_libcdep.cc')
-rw-r--r--lib/sanitizer_common/sanitizer_posix_libcdep.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/sanitizer_common/sanitizer_posix_libcdep.cc b/lib/sanitizer_common/sanitizer_posix_libcdep.cc
index 6c1a85239..20aed194e 100644
--- a/lib/sanitizer_common/sanitizer_posix_libcdep.cc
+++ b/lib/sanitizer_common/sanitizer_posix_libcdep.cc
@@ -272,7 +272,8 @@ void *MmapFixedNoReserve(uptr fixed_addr, uptr size, const char *name) {
void *MmapNoAccess(uptr fixed_addr, uptr size, const char *name) {
int fd = name ? GetNamedMappingFd(name, size) : -1;
- unsigned flags = MAP_PRIVATE | MAP_FIXED | MAP_NORESERVE;
+ unsigned flags = MAP_PRIVATE | MAP_NORESERVE;
+ if (fixed_addr != 0) flags |= MAP_FIXED;
if (fd == -1) flags |= MAP_ANON;
return (void *)internal_mmap((void *)fixed_addr, size, PROT_NONE, flags, fd,