Skip to content

Commit c691359

Browse files
committed
[1.10>master] [MERGE #5536 @rajatd] Handle failure to reserve pre-reserved section when initializing server thread context. OS#15209418
Merge pull request #5536 from rajatd:prereserved If we failed to reserve memory for the pre-reserved section when initializing the jit server thread context, when the jit process does the reservation, the client process has no way of knowing the start address of the pre-reserved section. Instead, don't try to allocate memory for jitted code in pre-reserved section if we couldn't reserve when initializing server thread context
2 parents 6338ac2 + 28040fe commit c691359

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

lib/Backend/ServerThreadContext.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,12 @@ ServerThreadContext::CanCreatePreReservedSegment() const
169169
return m_canCreatePreReservedSegment;
170170
}
171171

172+
void
173+
ServerThreadContext::SetCanCreatePreReservedSegment(bool value)
174+
{
175+
m_canCreatePreReservedSegment = value;
176+
}
177+
172178
bool
173179
ServerThreadContext::IsNumericProperty(Js::PropertyId propertyId)
174180
{

lib/Backend/ServerThreadContext.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class ServerThreadContext : public ThreadContextInfo
7272
intptr_t GetRuntimeChakraBaseAddress() const;
7373
intptr_t GetRuntimeCRTBaseAddress() const;
7474
bool CanCreatePreReservedSegment() const;
75-
75+
void SetCanCreatePreReservedSegment(bool value);
7676
static intptr_t GetJITCRTBaseAddress();
7777

7878
private:

lib/JITServer/JITServer.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ ServerInitializeThreadContext(
221221
if (!PHASE_OFF1(Js::PreReservedHeapAllocPhase))
222222
{
223223
*prereservedRegionAddr = (intptr_t)contextInfo->GetPreReservedSectionAllocator()->EnsurePreReservedRegion();
224+
contextInfo->SetCanCreatePreReservedSegment(*prereservedRegionAddr != 0);
224225
}
225226
#if !defined(_M_ARM)
226227
*jitThunkAddr = (intptr_t)contextInfo->GetJITThunkEmitter()->EnsureInitialized();

0 commit comments

Comments
 (0)