From e9b0ce81ca0bd8c5901ca2b621f11e9f11b5691f Mon Sep 17 00:00:00 2001 From: Viacheslav Nikolaev Date: Tue, 5 Jul 2016 09:33:46 +0300 Subject: [PATCH] One of the flags MAP_SHARED or MAP_PRIVATE has to be specified. MAP_PRIVATE seems to fit here. (dotnet/coreclr#6089) Commit migrated from https://github.com/dotnet/coreclr/commit/ad40ed696dbc696733e09422d57622ed574ecec8 --- src/coreclr/src/pal/src/map/map.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/src/pal/src/map/map.cpp b/src/coreclr/src/pal/src/map/map.cpp index cab9c6c..c0cd7a3 100644 --- a/src/coreclr/src/pal/src/map/map.cpp +++ b/src/coreclr/src/pal/src/map/map.cpp @@ -2416,7 +2416,7 @@ void * MAPMapPEFile(HANDLE hFile) { //if we're forcing relocs, create an anonymous mapping at the preferred base. Only create the //mapping if we can create it at the specified address. - pForceRelocBase = mmap( (void*)preferredBase, VIRTUAL_PAGE_SIZE, PROT_NONE, MAP_ANON|MAP_FIXED, -1, 0 ); + pForceRelocBase = mmap( (void*)preferredBase, VIRTUAL_PAGE_SIZE, PROT_NONE, MAP_ANON|MAP_FIXED|MAP_PRIVATE, -1, 0 ); if (pForceRelocBase == MAP_FAILED) { TRACE_(LOADER)("Attempt to take preferred base of %p to force relocation failed\n", (void*)preferredBase); @@ -2440,7 +2440,7 @@ void * MAPMapPEFile(HANDLE hFile) InternalEnterCriticalSection(pThread, &mapping_critsec); #if !defined(_AMD64_) - loadedBase = mmap((void*)preferredBase, virtualSize, PROT_NONE, MAP_ANON, -1, 0); + loadedBase = mmap((void*)preferredBase, virtualSize, PROT_NONE, MAP_ANON|MAP_PRIVATE, -1, 0); #else // defined(_AMD64_) // First try to reserve virtual memory using ExecutableAllcator. This allows all PE images to be // near each other and close to the coreclr library which also allows the runtime to generate -- 2.7.4