From 261574bf4121b40c7023c73571fb7a690397bd0f Mon Sep 17 00:00:00 2001 From: Gleb Balykov Date: Tue, 14 Jun 2022 20:34:25 +0300 Subject: [PATCH] Do not use ExecutableMemoryAllocator on 64 bit platforms if default base address usage is requested (#70563) --- 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)