summaryrefslogtreecommitdiff
path: root/packaging/0027-Revert-Prevent-memory-allocation-in-signal-handler.patch
diff options
context:
space:
mode:
Diffstat (limited to 'packaging/0027-Revert-Prevent-memory-allocation-in-signal-handler.patch')
-rw-r--r--packaging/0027-Revert-Prevent-memory-allocation-in-signal-handler.patch65
1 files changed, 65 insertions, 0 deletions
diff --git a/packaging/0027-Revert-Prevent-memory-allocation-in-signal-handler.patch b/packaging/0027-Revert-Prevent-memory-allocation-in-signal-handler.patch
new file mode 100644
index 0000000000..2d88908ac5
--- /dev/null
+++ b/packaging/0027-Revert-Prevent-memory-allocation-in-signal-handler.patch
@@ -0,0 +1,65 @@
+From a01acb182005e85a766fe05bdc5ce81c78b49586 Mon Sep 17 00:00:00 2001
+From: Mikhail Labiuk <m.labiuk@samsung.com>
+Date: Mon, 19 Feb 2018 19:08:50 +0300
+Subject: [PATCH 27/47] Revert "Prevent memory allocation in signal handler"
+
+This reverts commit fa6087f0c2856215e7141259b56e75b46746f74d.
+---
+ src/pal/src/exception/seh-unwind.cpp | 6 ++----
+ src/pal/src/exception/signal.cpp | 2 +-
+ src/pal/src/include/pal/seh.hpp | 3 +--
+ 3 files changed, 4 insertions(+), 7 deletions(-)
+
+diff --git a/src/pal/src/exception/seh-unwind.cpp b/src/pal/src/exception/seh-unwind.cpp
+index eba2c80..7746bbb 100644
+--- a/src/pal/src/exception/seh-unwind.cpp
++++ b/src/pal/src/exception/seh-unwind.cpp
+@@ -620,14 +620,12 @@ Function:
+ Parameters:
+ exceptionRecord - output pointer to the allocated exception record
+ contextRecord - output pointer to the allocated context record
+- allocationProhibited - input flag to avoid memory allocation in critical situations
+ --*/
+ VOID
+-AllocateExceptionRecords(EXCEPTION_RECORD** exceptionRecord, CONTEXT** contextRecord, BOOL allocationProhibited)
++AllocateExceptionRecords(EXCEPTION_RECORD** exceptionRecord, CONTEXT** contextRecord)
+ {
+ ExceptionRecords* records;
+- if (allocationProhibited ||
+- (posix_memalign((void**)&records, alignof(ExceptionRecords), sizeof(ExceptionRecords)) != 0) )
++ if (posix_memalign((void**)&records, alignof(ExceptionRecords), sizeof(ExceptionRecords)) != 0)
+ {
+ size_t bitmap;
+ size_t newBitmap;
+diff --git a/src/pal/src/exception/signal.cpp b/src/pal/src/exception/signal.cpp
+index 90da207..bf48619 100644
+--- a/src/pal/src/exception/signal.cpp
++++ b/src/pal/src/exception/signal.cpp
+@@ -808,7 +808,7 @@ static bool common_signal_handler(int code, siginfo_t *siginfo, void *sigcontext
+ ucontext = (native_context_t *)sigcontext;
+ g_common_signal_handler_context_locvar_offset = (int)((char*)&signalContextRecord - (char*)__builtin_frame_address(0));
+
+- AllocateExceptionRecords(&exceptionRecord, &contextRecord, true);
++ AllocateExceptionRecords(&exceptionRecord, &contextRecord);
+
+ exceptionRecord->ExceptionCode = CONTEXTGetExceptionCodeForSignal(siginfo, ucontext);
+ exceptionRecord->ExceptionFlags = EXCEPTION_IS_SIGNAL;
+diff --git a/src/pal/src/include/pal/seh.hpp b/src/pal/src/include/pal/seh.hpp
+index 5edc214..3ac93d6 100644
+--- a/src/pal/src/include/pal/seh.hpp
++++ b/src/pal/src/include/pal/seh.hpp
+@@ -84,10 +84,9 @@ Function:
+ Parameters:
+ exceptionRecord - output pointer to the allocated Windows exception record
+ contextRecord - output pointer to the allocated Windows context record
+- allocationProhibited - input flag to avoid memory allocation in critical situations
+ --*/
+ VOID
+-AllocateExceptionRecords(EXCEPTION_RECORD** exceptionRecord, CONTEXT** contextRecord, BOOL allocationProhibited=false);
++AllocateExceptionRecords(EXCEPTION_RECORD** exceptionRecord, CONTEXT** contextRecord);
+
+ #if !HAVE_MACH_EXCEPTIONS
+ // TODO: Implement for Mach exceptions. Not in CoreCLR surface area.
+--
+2.7.4
+