summaryrefslogtreecommitdiff
path: root/src/pal
diff options
context:
space:
mode:
authorKonstantin Baladurin <k.baladurin@partner.samsung.com>2018-01-30 17:05:57 +0300
committerJan Vorlicek <janvorli@microsoft.com>2018-01-30 15:05:57 +0100
commitb039a4c266b3d64549c4a809b7ea28a69b600358 (patch)
treeae94a60cd9327e87d80fbaaecfbee5a5562733a2 /src/pal
parent7ab27c46cfca8b2a751316d82ea864267d1fcda4 (diff)
downloadcoreclr-b039a4c266b3d64549c4a809b7ea28a69b600358.tar.gz
coreclr-b039a4c266b3d64549c4a809b7ea28a69b600358.tar.bz2
coreclr-b039a4c266b3d64549c4a809b7ea28a69b600358.zip
ThrowExceptionFromContextInternal, RtlCaptureContext: fix for asan (#16074)
- Save arguments on stack before calling __asan_handle_no_return in ThrowExceptionFromContextInternal - Fix saving arguments on stack before calling __asan_handle_no_return in RtlCaptureContext for arm64
Diffstat (limited to 'src/pal')
-rw-r--r--src/pal/src/arch/amd64/exceptionhelper.S4
-rw-r--r--src/pal/src/arch/arm/exceptionhelper.S2
-rw-r--r--src/pal/src/arch/arm64/context2.S4
-rw-r--r--src/pal/src/arch/arm64/exceptionhelper.S2
4 files changed, 10 insertions, 2 deletions
diff --git a/src/pal/src/arch/amd64/exceptionhelper.S b/src/pal/src/arch/amd64/exceptionhelper.S
index 72a1393a3c..cb9a545d20 100644
--- a/src/pal/src/arch/amd64/exceptionhelper.S
+++ b/src/pal/src/arch/amd64/exceptionhelper.S
@@ -17,7 +17,11 @@ LEAF_ENTRY ThrowExceptionFromContextInternal, _TEXT
#ifdef HAS_ASAN
// Need to call __asan_handle_no_return explicitly here because we re-intialize RSP before
// throwing exception in ThrowExceptionHelper
+ push_nonvol_reg rdi
+ push_nonvol_reg rsi
call EXTERNAL_C_FUNC(__asan_handle_no_return)
+ pop_nonvol_reg rsi
+ pop_nonvol_reg rdi
#endif
// Save the RBP to the stack so that the unwind can work at the instruction after
diff --git a/src/pal/src/arch/arm/exceptionhelper.S b/src/pal/src/arch/arm/exceptionhelper.S
index dad48de47a..4e324ce3bd 100644
--- a/src/pal/src/arch/arm/exceptionhelper.S
+++ b/src/pal/src/arch/arm/exceptionhelper.S
@@ -14,7 +14,9 @@ LEAF_ENTRY ThrowExceptionFromContextInternal, _TEXT
#ifdef HAS_ASAN
// Need to call __asan_handle_no_return explicitly here because we re-intialize SP before
// throwing exception in ThrowExceptionHelper
+ push_nonvol_reg "{r0, r1}"
bl EXTERNAL_C_FUNC(__asan_handle_no_return)
+ pop_nonvol_reg "{r0, r1}"
#endif
push_nonvol_reg {r7} /* FP. x64-RBP */
diff --git a/src/pal/src/arch/arm64/context2.S b/src/pal/src/arch/arm64/context2.S
index ac3661ad54..64a19c9df6 100644
--- a/src/pal/src/arch/arm64/context2.S
+++ b/src/pal/src/arch/arm64/context2.S
@@ -138,9 +138,9 @@ LEAF_ENTRY RtlRestoreContext, _TEXT
ldr w17, [x0, #(CONTEXT_ContextFlags)]
tbz w17, #CONTEXT_CONTROL_BIT, LOCAL_LABEL(Restore_CONTEXT_FLOATING_POINT)
- stp x0, x1, [sp]
+ stp x0, x1, [sp, -16]!
bl EXTERNAL_C_FUNC(__asan_handle_no_return)
- ldp x0, x1, [sp]
+ ldp x0, x1, [sp], 16
LOCAL_LABEL(Restore_CONTEXT_FLOATING_POINT):
#endif
diff --git a/src/pal/src/arch/arm64/exceptionhelper.S b/src/pal/src/arch/arm64/exceptionhelper.S
index 7deeee69af..c4499fb93f 100644
--- a/src/pal/src/arch/arm64/exceptionhelper.S
+++ b/src/pal/src/arch/arm64/exceptionhelper.S
@@ -15,7 +15,9 @@ LEAF_ENTRY ThrowExceptionFromContextInternal, _TEXT
#ifdef HAS_ASAN
// Need to call __asan_handle_no_return explicitly here because we re-intialize SP before
// throwing exception in ThrowExceptionHelper
+ stp x0, x1, [sp, -16]!
bl EXTERNAL_C_FUNC(__asan_handle_no_return)
+ ldp x0, x1, [sp], 16
#endif
// Save the FP & LR to the stack so that the unwind can work at the instruction after