From 1cd2216cd962f87a6adf03ee86851a76ac5dd313 Mon Sep 17 00:00:00 2001 From: Gleb Balykov Date: Fri, 10 Jun 2022 16:44:30 +0300 Subject: [PATCH] Do not use ExecutableMemoryAllocator on 64 bit platforms if default base address usage is requested --- src/coreclr/pal/src/map/map.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/coreclr/pal/src/map/map.cpp b/src/coreclr/pal/src/map/map.cpp index 55b6aa3fecf0e..ad3a453aa539f 100644 --- a/src/coreclr/pal/src/map/map.cpp +++ b/src/coreclr/pal/src/map/map.cpp @@ -2284,7 +2284,13 @@ void * MAPMapPEFile(HANDLE hFile, off_t offset) // more efficient code (by avoiding usage of jump stubs). Alignment to a 64 KB granularity should // not be necessary (alignment to page size should be sufficient), but see // ExecutableMemoryAllocator::AllocateMemory() for the reason why it is done. - loadedBase = ReserveMemoryFromExecutableAllocator(pThread, ALIGN_UP(reserveSize, VIRTUAL_64KB)); + +#ifdef FEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION + if (!g_useDefaultBaseAddr) +#endif // FEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION + { + loadedBase = ReserveMemoryFromExecutableAllocator(pThread, ALIGN_UP(reserveSize, VIRTUAL_64KB)); + } #endif // HOST_64BIT if (loadedBase == NULL)