Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
54bb24f
Merge in 'release/6.0' changes
dotnet-bot Feb 8, 2023
c2c7afa
Merge in 'release/6.0' changes
dotnet-bot Feb 8, 2023
d411de8
Merge in 'release/6.0' changes
dotnet-bot Feb 8, 2023
3961581
Merge in 'release/6.0' changes
dotnet-bot Feb 8, 2023
3859f81
Merge in 'release/6.0' changes
dotnet-bot Feb 8, 2023
75e3eac
Merge in 'release/6.0' changes
dotnet-bot Feb 8, 2023
3d2923d
Merge in 'release/6.0' changes
dotnet-bot Feb 8, 2023
6275102
Merge in 'release/6.0' changes
dotnet-bot Feb 8, 2023
7f24ff7
Merge in 'release/6.0' changes
dotnet-bot Feb 8, 2023
b100014
Merge in 'release/6.0' changes
dotnet-bot Feb 8, 2023
1b85704
Merge in 'release/6.0' changes
dotnet-bot Feb 9, 2023
8c4e317
Merge in 'release/6.0' changes
dotnet-bot Feb 9, 2023
ca4d7bb
Merge in 'release/6.0' changes
dotnet-bot Feb 9, 2023
47b46c3
Merge in 'release/6.0' changes
dotnet-bot Feb 10, 2023
e0c5bf0
Merge in 'release/6.0' changes
dotnet-bot Feb 10, 2023
d0004a3
Merged PR 28980: Fix TimeZone when reading invalid TZ files
tarekgh Feb 10, 2023
3a8c500
Merge in 'release/6.0' changes
dotnet-bot Feb 10, 2023
d4a7595
Merge in 'release/6.0' changes
dotnet-bot Feb 11, 2023
4ef7e67
Merge in 'release/6.0' changes
dotnet-bot Feb 13, 2023
5789ff7
Merge in 'release/6.0' changes
dotnet-bot Feb 13, 2023
9b4f0e3
Merge in 'release/6.0' changes
dotnet-bot Feb 14, 2023
0aa8845
Merge in 'release/6.0' changes
dotnet-bot Feb 14, 2023
22da7ee
Merge in 'release/6.0' changes
dotnet-bot Feb 15, 2023
5edef4b
Merge in 'release/6.0' changes
dotnet-bot Feb 16, 2023
adc4201
Merge commit '5edef4b20babd4c3ddac7460e536f86fd0f2d724' into internal…
vseanreesermsft Mar 14, 2023
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
29 changes: 29 additions & 0 deletions src/coreclr/dlls/mscoree/unixinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,25 @@

#define ASSERTE_ALL_BUILDS(expr) _ASSERTE_ALL_BUILDS(__FILE__, (expr))

#ifdef TARGET_UNIX
#define NO_HOSTING_API_RETURN_ADDRESS ((void*)ULONG_PTR_MAX)
void* g_hostingApiReturnAddress = NO_HOSTING_API_RETURN_ADDRESS;

class HostingApiFrameHolder
{
public:
HostingApiFrameHolder(void* returnAddress)
{
g_hostingApiReturnAddress = returnAddress;
}

~HostingApiFrameHolder()
{
g_hostingApiReturnAddress = NO_HOSTING_API_RETURN_ADDRESS;
}
};
#endif // TARGET_UNIX

// Holder for const wide strings
typedef NewArrayHolder<const WCHAR> ConstWStringHolder;

Expand Down Expand Up @@ -179,6 +198,7 @@ extern "C" int coreclr_create_delegate(void*, unsigned int, const char*, const c
// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed
//
extern "C"
NOINLINE
DLLEXPORT
int coreclr_initialize(
const char* exePath,
Expand All @@ -197,6 +217,10 @@ int coreclr_initialize(
bool hostPolicyEmbedded = false;
PInvokeOverrideFn* pinvokeOverride = nullptr;

#ifdef TARGET_UNIX
HostingApiFrameHolder apiFrameHolder(_ReturnAddress());
#endif

ConvertConfigPropertiesToUnicode(
propertyKeys,
propertyValues,
Expand Down Expand Up @@ -421,6 +445,7 @@ int coreclr_create_delegate(
// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed
//
extern "C"
NOINLINE
DLLEXPORT
int coreclr_execute_assembly(
void* hostHandle,
Expand All @@ -436,6 +461,10 @@ int coreclr_execute_assembly(
}
*exitCode = -1;

#ifdef TARGET_UNIX
HostingApiFrameHolder apiFrameHolder(_ReturnAddress());
#endif

ICLRRuntimeHost4* host = reinterpret_cast<ICLRRuntimeHost4*>(hostHandle);

ConstWStringArrayHolder argvW;
Expand Down
5 changes: 4 additions & 1 deletion src/coreclr/vm/exceptionhandling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4518,6 +4518,8 @@ VOID UnwindManagedExceptionPass2(PAL_SEHException& ex, CONTEXT* unwindStartConte
EEPOLICY_HANDLE_FATAL_ERROR(COR_E_EXECUTIONENGINE);
}

extern void* g_hostingApiReturnAddress;

//---------------------------------------------------------------------------------------
//
// This functions performs dispatching of a managed exception.
Expand Down Expand Up @@ -4713,7 +4715,8 @@ VOID DECLSPEC_NORETURN UnwindManagedExceptionPass1(PAL_SEHException& ex, CONTEXT

STRESS_LOG2(LF_EH, LL_INFO100, "Processing exception at native frame: IP = %p, SP = %p \n", controlPc, sp);

if (controlPc == 0)
// Consider the exception unhandled if the unwinding cannot proceed further or if it went past the coreclr_initialize or coreclr_execute_assembly
if ((controlPc == 0) || (controlPc == (UINT_PTR)g_hostingApiReturnAddress))
{
if (!GetThread()->HasThreadStateNC(Thread::TSNC_ProcessedUnhandledException))
{
Expand Down
5 changes: 4 additions & 1 deletion src/coreclr/vm/stackwalk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,8 @@ PCODE Thread::VirtualUnwindNonLeafCallFrame(T_CONTEXT* pContext, KNONVOLATILE_CO
return uControlPc;
}

extern void* g_hostingApiReturnAddress;

// static
UINT_PTR Thread::VirtualUnwindToFirstManagedCallFrame(T_CONTEXT* pContext)
{
Expand Down Expand Up @@ -739,8 +741,9 @@ UINT_PTR Thread::VirtualUnwindToFirstManagedCallFrame(T_CONTEXT* pContext)

uControlPc = GetIP(pContext);

if (uControlPc == 0)
if ((uControlPc == 0) || (uControlPc == (PCODE)g_hostingApiReturnAddress))
{
uControlPc = 0;
break;
}
#endif // !TARGET_UNIX
Expand Down