Skip to content

Commit 010ddf9

Browse files
committed
The card table has code to handle stack allocations,
but this code was only run on the main thread and on, our own background threads. Threads trying to use the JSRT could end up getting segfaults from write barriers from Fields on stack variables that weren't known to the write barrier.
1 parent f253c90 commit 010ddf9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/Runtime/Base/ThreadContextTlsEntry.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,14 @@ bool ThreadContextTLSEntry::TrySetThreadContext(ThreadContext * threadContext)
8787
if (entry == NULL)
8888
{
8989
Assert(!threadContext->IsThreadBound());
90+
#ifdef RECYCLER_WRITE_BARRIER
91+
#ifdef TARGET_64
92+
if (!Memory::RecyclerWriteBarrierManager::OnThreadInit())
93+
{
94+
return false;
95+
}
96+
#endif
97+
#endif
9098
entry = CreateEntryForCurrentThread();
9199
#ifndef _WIN32
92100
ENTRY_FOR_CURRENT_THREAD() = entry;

0 commit comments

Comments
 (0)