From 023257957c4d7b899762047d1f5668067a37e6f4 Mon Sep 17 00:00:00 2001 From: Jonghyun Park Date: Wed, 1 Feb 2017 10:46:32 +0900 Subject: [PATCH] [x86/Linux] Get Frame Pointer from CallerSp (dotnet/coreclr#9235) GetGSCookieAddress uses pEbp to get the current frame pointer, but pEbp is not properly initialized as discussed in dotnet/coreclr#8980. This commit revises GetGSCookieAddress to use CallerSp (as in other architectures) to get Frame Pointer in order to fix dotnet/coreclr#8980. Commit migrated from https://github.com/dotnet/coreclr/commit/6be2bed47d823b49603969c37a382f994da0b0ff --- src/coreclr/src/vm/eetwain.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/coreclr/src/vm/eetwain.cpp b/src/coreclr/src/vm/eetwain.cpp index f7257f5..11a4590 100644 --- a/src/coreclr/src/vm/eetwain.cpp +++ b/src/coreclr/src/vm/eetwain.cpp @@ -5465,7 +5465,15 @@ void * EECodeManager::GetGSCookieAddr(PREGDISPLAY pContext, if (info->ebpFrame) { - return PVOID(SIZE_T((DWORD(*pContext->pEbp) - info->gsCookieOffset))); + DWORD curEBP; + +#ifdef WIN64EXCEPTIONS + curEBP = GetCallerSp(pContext) - 2 * 4; +#else + curEBP = *pContext->pEbp; +#endif + + return PVOID(SIZE_T(curEBP - info->gsCookieOffset)); } else { -- 2.7.4