diff --git a/Makefile b/Makefile index c779471..6191a46 100644 --- a/Makefile +++ b/Makefile @@ -83,6 +83,7 @@ MALLOC_HOOK = -DMALLOC_HOOK=1 ## Use Huge pages for any allocation that is a multiple ## of 2 megabytes. See PERFORMANCE.md for additional info HUGE_PAGES = -DHUGE_PAGES=1 +THP_PAGES = -DTHP_PAGES=1 ## Enable the built-in heap profiler. When this is enabled ## IsoAlloc will write a file to disk upon exit of the @@ -316,7 +317,7 @@ endif CFLAGS += $(COMMON_CFLAGS) $(DISABLE_CANARY) $(BUILD_ERROR_FLAGS) $(HOOKS) $(HEAP_PROFILER) -fvisibility=hidden \ -std=$(STDC) $(SANITIZER_SUPPORT) $(ALLOC_SANITY) $(MEMCPY_SANITY) $(UNINIT_READ_SANITY) $(CPU_PIN) $(SCHED_GETCPU) \ $(EXPERIMENTAL) $(UAF_PTR_PAGE) $(VERIFY_FREE_BIT_SLOTS) $(NAMED_MAPPINGS) $(ABORT_ON_NULL) $(NO_ZERO_ALLOCATIONS) \ - $(ABORT_NO_ENTROPY) $(ISO_DTOR_CLEANUP) $(RANDOMIZE_FREELIST) $(USE_SPINLOCK) $(HUGE_PAGES) $(USE_MLOCK) \ + $(ABORT_NO_ENTROPY) $(ISO_DTOR_CLEANUP) $(RANDOMIZE_FREELIST) $(USE_SPINLOCK) $(HUGE_PAGES) ${THP_PAGES} $(USE_MLOCK) \ $(MEMORY_TAGGING) $(STRONG_SIZE_ISOLATION) $(MEMSET_SANITY) $(AUTO_CTOR_DTOR) $(SIGNAL_HANDLER) \ $(BIG_ZONE_META_DATA_GUARD) $(BIG_ZONE_GUARD) $(PROTECT_UNUSED_BIG_ZONE) $(MASK_PTRS) $(SANITIZE_CHUNKS) $(FUZZ_MODE) \ $(PERM_FREE_REALLOC) $(ARM_MTE) $(DONT_USE_NEON) diff --git a/src/iso_alloc_util.c b/src/iso_alloc_util.c index 6a5d95a..132780e 100644 --- a/src/iso_alloc_util.c +++ b/src/iso_alloc_util.c @@ -157,7 +157,7 @@ void *mmap_pages(size_t size, bool populate, const char *name, int32_t prot) { LOG_AND_ABORT("Failed to mmap rw pages"); } -#if __linux__ && MAP_HUGETLB && HUGE_PAGES && MADV_HUGEPAGE +#if __linux__ && MAP_HUGETLB && HUGE_PAGES && THP_PAGES && MADV_HUGEPAGE if(sz == ZONE_USER_SIZE || sz == (ZONE_USER_SIZE >> 1)) { madvise(p, sz, MADV_HUGEPAGE); }