summaryrefslogtreecommitdiff
path: root/packaging/0003-ThrowExceptionFromContextInternal-RtlCaptureContext-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'packaging/0003-ThrowExceptionFromContextInternal-RtlCaptureContext-.patch')
-rw-r--r--packaging/0003-ThrowExceptionFromContextInternal-RtlCaptureContext-.patch81
1 files changed, 81 insertions, 0 deletions
diff --git a/packaging/0003-ThrowExceptionFromContextInternal-RtlCaptureContext-.patch b/packaging/0003-ThrowExceptionFromContextInternal-RtlCaptureContext-.patch
new file mode 100644
index 0000000000..058fe3fe5e
--- /dev/null
+++ b/packaging/0003-ThrowExceptionFromContextInternal-RtlCaptureContext-.patch
@@ -0,0 +1,81 @@
+From b71438bf6607d6d35f3cfb1bbfe4a525c06cf656 Mon Sep 17 00:00:00 2001
+From: Konstantin Baladurin <k.baladurin@partner.samsung.com>
+Date: Tue, 30 Jan 2018 17:05:57 +0300
+Subject: [PATCH 3/4] 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
+---
+ src/pal/src/arch/amd64/exceptionhelper.S | 4 ++++
+ src/pal/src/arch/arm/exceptionhelper.S | 2 ++
+ src/pal/src/arch/arm64/context2.S | 4 ++--
+ src/pal/src/arch/arm64/exceptionhelper.S | 2 ++
+ 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 72a1393..cb9a545 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 dad48de..4e324ce 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 ac3661a..64a19c9 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 7deeee6..c4499fb 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
+--
+2.7.4
+