Do not use ExecutableMemoryAllocator on 64 bit platforms if default base address...
authorGleb Balykov <g.balykov@samsung.com>
Tue, 14 Jun 2022 17:34:25 +0000 (20:34 +0300)
committerGitHub <noreply@github.com>
Tue, 14 Jun 2022 17:34:25 +0000 (19:34 +0200)
src/coreclr/pal/src/map/map.cpp

index 55b6aa3..ad3a453 100644 (file)
@@ -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)