Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit ad40ed6

Browse files
papaslavikjkotas
authored andcommitted
One of the flags MAP_SHARED or MAP_PRIVATE has to be specified. MAP_PRIVATE seems to fit here. (#6089)
1 parent c928700 commit ad40ed6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pal/src/map/map.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2416,7 +2416,7 @@ void * MAPMapPEFile(HANDLE hFile)
24162416
{
24172417
//if we're forcing relocs, create an anonymous mapping at the preferred base. Only create the
24182418
//mapping if we can create it at the specified address.
2419-
pForceRelocBase = mmap( (void*)preferredBase, VIRTUAL_PAGE_SIZE, PROT_NONE, MAP_ANON|MAP_FIXED, -1, 0 );
2419+
pForceRelocBase = mmap( (void*)preferredBase, VIRTUAL_PAGE_SIZE, PROT_NONE, MAP_ANON|MAP_FIXED|MAP_PRIVATE, -1, 0 );
24202420
if (pForceRelocBase == MAP_FAILED)
24212421
{
24222422
TRACE_(LOADER)("Attempt to take preferred base of %p to force relocation failed\n", (void*)preferredBase);
@@ -2440,7 +2440,7 @@ void * MAPMapPEFile(HANDLE hFile)
24402440
InternalEnterCriticalSection(pThread, &mapping_critsec);
24412441

24422442
#if !defined(_AMD64_)
2443-
loadedBase = mmap((void*)preferredBase, virtualSize, PROT_NONE, MAP_ANON, -1, 0);
2443+
loadedBase = mmap((void*)preferredBase, virtualSize, PROT_NONE, MAP_ANON|MAP_PRIVATE, -1, 0);
24442444
#else // defined(_AMD64_)
24452445
// First try to reserve virtual memory using ExecutableAllcator. This allows all PE images to be
24462446
// near each other and close to the coreclr library which also allows the runtime to generate

0 commit comments

Comments
 (0)