Skip to content

Commit

Permalink
[release/7.0] Fix reserving executable memory as per allocation type …
Browse files Browse the repository at this point in the history
…in ClrVirtualAllocWithinRange() (#83958)

* Fix reserving executable memory as per allocation type in ClrVirtualAllocWithinRange()

Fixes #83818

---------

Co-authored-by: Ilia K <ki.stfu@gmail.com>
Co-authored-by: Carlos Sánchez López <1175054+carlossanlop@users.noreply.github.com>
  • Loading branch information
3 people authored Apr 10, 2023
1 parent 7e8c33e commit 50722b0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/coreclr/utilcode/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ BYTE * ClrVirtualAllocWithinRange(const BYTE *pMinAddr,
{
NOTHROW;
PRECONDITION(dwSize != 0);
PRECONDITION(flAllocationType == MEM_RESERVE);
PRECONDITION(flAllocationType == MEM_RESERVE); // ORed with MEM_RESERVE_EXECUTABLE on Unix
}
CONTRACTL_END;

Expand Down Expand Up @@ -449,7 +449,7 @@ BYTE * ClrVirtualAllocWithinRange(const BYTE *pMinAddr,
(mbInfo.RegionSize >= (SIZE_T) dwSize || mbInfo.RegionSize == 0))
{
// Try reserving the memory using VirtualAlloc now
pResult = (BYTE*)ClrVirtualAlloc(tryAddr, dwSize, MEM_RESERVE, flProtect);
pResult = (BYTE*)ClrVirtualAlloc(tryAddr, dwSize, flAllocationType, flProtect);

// Normally this will be successful
//
Expand Down

0 comments on commit 50722b0

Please sign in to comment.