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

Commit 3e0b7de

Browse files
committed
Selective VirtualProtect in debugger heap for Realloc
1 parent f712e90 commit 3e0b7de

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/debug/ee/debugger.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16802,14 +16802,17 @@ void *DebuggerHeap::Realloc(void *pMem, DWORD newSize, DWORD oldSize)
1680216802

1680316803

1680416804
#ifdef FEATURE_PAL
16805-
// We don't have executable heap in PAL, but we still need to allocate
16806-
// executable memory, that's why have change protection level for
16807-
// each allocation.
16808-
// UNIXTODO: We need to look how JIT solves this problem.
16809-
DWORD unusedFlags;
16810-
if (!VirtualProtect(ret, newSize, PAGE_EXECUTE_READWRITE, &unusedFlags))
16811-
{
16812-
_ASSERTE(!"VirtualProtect failed to make this memory executable");
16805+
if (m_fExecutable)
16806+
{
16807+
// We don't have executable heap in PAL, but we still need to allocate
16808+
// executable memory, that's why have change protection level for
16809+
// each allocation.
16810+
// UNIXTODO: We need to look how JIT solves this problem.
16811+
DWORD unusedFlags;
16812+
if (!VirtualProtect(ret, newSize, PAGE_EXECUTE_READWRITE, &unusedFlags))
16813+
{
16814+
_ASSERTE(!"VirtualProtect failed to make this memory executable");
16815+
}
1681316816
}
1681416817
#endif // FEATURE_PAL
1681516818

0 commit comments

Comments
 (0)