Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress GS cookie checks in method epilogs #40637

Merged
merged 1 commit into from
Aug 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/coreclr/src/vm/eetwain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5626,11 +5626,14 @@ void * EECodeManager::GetGSCookieAddr(PREGDISPLAY pContext,
INT32 spOffsetGSCookie = gcInfoDecoder.GetGSCookieStackSlot();
if (spOffsetGSCookie != NO_GS_COOKIE)
{
if(relOffset >= gcInfoDecoder.GetGSCookieValidRangeStart()
&& relOffset < gcInfoDecoder.GetGSCookieValidRangeEnd())
if(relOffset >= gcInfoDecoder.GetGSCookieValidRangeStart())
{
SIZE_T baseStackSlot = GetCallerSp(pContext);
return (LPVOID)( spOffsetGSCookie + baseStackSlot );
TADDR ptr = GetCallerSp(pContext) + spOffsetGSCookie;

// Detect the end of GS cookie scope by comparing its address with SP
// gcInfoDecoder.GetGSCookieValidRangeEnd() is not accurate. It does not
// account for GS cookie going out of scope inside epilog or multiple epilogs.
return (LPVOID) ((ptr >= pContext->SP) ? ptr : NULL);
}
}
return NULL;
Expand Down