[PATCH] D65851: [Sanitizer] Using huge page on FreeBSD for shadow mapping
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 7 12:55:35 PDT 2019
vitalybuka added inline comments.
================
Comment at: compiler-rt/lib/asan/asan_shadow_setup.cpp:33
DecreaseTotalMmap(size); // Don't count the shadow against mmap_limit_mb.
+#if SANITIZER_LINUX
+ // Only Linux supports THP feature
----------------
Please remove #if and use MmapFixedSuperPage always
================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_common.h:103
WARN_UNUSED_RESULT;
+bool MmapFixedSuperPage(uptr fixed_addr, uptr size, const char *name = nullptr);
void *MmapNoReserveOrDie(uptr size, const char *mem_type);
----------------
WARN_UNUSED_RESULT?
================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_common.h:103
WARN_UNUSED_RESULT;
+bool MmapFixedSuperPage(uptr fixed_addr, uptr size, const char *name = nullptr);
void *MmapNoReserveOrDie(uptr size, const char *mem_type);
----------------
vitalybuka wrote:
>
> WARN_UNUSED_RESULT?
MmapFixedSuperPage -> MmapFixedSuperNoReserve
================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp:322
}
+bool MmapFixedSuperPage(uptr fixed_addr, uptr size, const char *name) {
----------------
Please extract
```
static bool MmapFixed(uptr fixed_addr, uptr size, int additional_flags, const char *name) {
size = RoundUpTo(size, GetPageSizeCached());
fixed_addr = RoundDownTo(fixed_addr, GetPageSizeCached());
uptr p = MmapNamed((void *)fixed_addr, size, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_FIXED | MAP_ANON | additional_flags, name);
int reserrno;
if (internal_iserror(p, &reserrno)) {
Report("ERROR: %s failed to "
"allocate 0x%zx (%zd) bytes at address %zx (errno: %d)\n",
SanitizerToolName, size, size, fixed_addr, reserrno);
return false;
}
IncreaseTotalMmap(size);
return true;
}
```
and use it here and in MmapFixedNoReserve
Repository:
rCRT Compiler Runtime
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65851/new/
https://reviews.llvm.org/D65851
More information about the llvm-commits
mailing list