diff options
author | Yongseop Kim <yons.kim@samsung.com> | 2017-03-01 23:52:35 +0900 |
---|---|---|
committer | Jan Vorlicek <janvorli@microsoft.com> | 2017-03-01 15:52:35 +0100 |
commit | e491a912e393610f1c987f1f814fdd3d04160479 (patch) | |
tree | 17e93607b0d46d4ab5b4a544eb5a179542404841 /src/vm/exceptionhandling.cpp | |
parent | af6738e34d1c5942dd23eed03c629a5dfaaae10c (diff) | |
download | coreclr-e491a912e393610f1c987f1f814fdd3d04160479.tar.gz coreclr-e491a912e393610f1c987f1f814fdd3d04160479.tar.bz2 coreclr-e491a912e393610f1c987f1f814fdd3d04160479.zip |
[x86/linux] Add IsIPinVirtualStub() on x86/linux (#9844)
* [x86/linux] Add IsIPinVirtualStub() on x86/linux #9691
To pass Loader.classloader.methodoverriding.regressions.549411.exploit
test failure on x86/linux. This patch is from #5542.
Diffstat (limited to 'src/vm/exceptionhandling.cpp')
-rw-r--r-- | src/vm/exceptionhandling.cpp | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/src/vm/exceptionhandling.cpp b/src/vm/exceptionhandling.cpp index bb30ee4bbb..69bb1f1d79 100644 --- a/src/vm/exceptionhandling.cpp +++ b/src/vm/exceptionhandling.cpp @@ -5042,6 +5042,39 @@ BOOL IsSafeToCallExecutionManager() GCStress<cfg_instr_ngen>::IsEnabled(); } +#if defined(_TARGET_ARM_) || defined(_TARGET_X86_) +//Return TRUE if pContext->Pc is in VirtualStub +static BOOL IsIPinVirtualStub(PCODE f_IP) +{ + LIMITED_METHOD_CONTRACT; + + Thread * pThread = GetThread(); + + // We may not have a managed thread object. Example is an AV on the helper thread. + // (perhaps during StubManager::IsStub) + if (pThread == NULL) + { + return FALSE; + } + + VirtualCallStubManager::StubKind sk; + VirtualCallStubManager::FindStubManager(f_IP, &sk); + + if (sk == VirtualCallStubManager::SK_DISPATCH) + { + return TRUE; + } + else if (sk == VirtualCallStubManager::SK_RESOLVE) + { + return TRUE; + } + + else { + return FALSE; + } +} +#endif + BOOL IsSafeToHandleHardwareException(PCONTEXT contextRecord, PEXCEPTION_RECORD exceptionRecord) { PCODE controlPc = GetIP(contextRecord); @@ -5049,7 +5082,7 @@ BOOL IsSafeToHandleHardwareException(PCONTEXT contextRecord, PEXCEPTION_RECORD e exceptionRecord->ExceptionCode == STATUS_BREAKPOINT || exceptionRecord->ExceptionCode == STATUS_SINGLE_STEP || (IsSafeToCallExecutionManager() && ExecutionManager::IsManagedCode(controlPc)) || -#ifdef _TARGET_ARM_ +#if defined(_TARGET_ARM_) || defined(_TARGET_X86_) IsIPinVirtualStub(controlPc) || // access violation comes from DispatchStub of Interface call #endif IsIPInMarkedJitHelper(controlPc)); @@ -5100,7 +5133,7 @@ BOOL HandleHardwareException(PAL_SEHException* ex) PAL_VirtualUnwind(ex->GetContextRecord(), NULL); ex->GetExceptionRecord()->ExceptionAddress = (PVOID)GetIP(ex->GetContextRecord()); } -#ifdef _TARGET_ARM_ +#if defined(_TARGET_ARM_) || defined(_TARGET_X86_) else if (IsIPinVirtualStub(controlPc)) { AdjustContextForVirtualStub(ex->GetExceptionRecord(), ex->GetContextRecord()); |