summaryrefslogtreecommitdiffstats
path: root/debian/patches/catch_SIGSTKSZ.patch
blob: 8f0765a8cbe75c035bc943bba4defd6d18bc4a50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Index: opentracing-cpp-1.6.0/3rd_party/include/opentracing/catch2/catch.hpp
===================================================================
--- opentracing-cpp-1.6.0.orig/3rd_party/include/opentracing/catch2/catch.hpp
+++ opentracing-cpp-1.6.0/3rd_party/include/opentracing/catch2/catch.hpp
@@ -6571,6 +6571,17 @@ namespace Catch {
         int id;
         const char* name;
     };
+
+    // 32kb for the alternate stack seems to be sufficient. However, this value
+    // is experimentally determined, so that's not guaranteed.
+    #if defined(_SC_SIGSTKSZ_SOURCE) || defined(_GNU_SOURCE)
+        // on glibc > 2.33 this is no longer constant, see
+        // https://sourceware.org/git/?p=glibc.git;a=blob;f=NEWS;h=85e84fe53699fe9e392edffa993612ce08b2954a;hb=HEAD
+        static constexpr std::size_t altStackSize = 32 * 1024;
+    #else
+        static constexpr std::size_t altStackSize = std::max(static_cast<size_t>(SIGSTKSZ), 32 * 1024)
+    #endif
+
     static SignalDefs signalDefs[] = {
         { SIGINT,  "SIGINT - Terminal interrupt signal" },
         { SIGILL,  "SIGILL - Illegal instruction signal" },
@@ -6597,7 +6608,7 @@ namespace Catch {
         isSet = true;
         stack_t sigStack;
         sigStack.ss_sp = altStackMem;
-        sigStack.ss_size = SIGSTKSZ;
+        sigStack.ss_size = altStackSize;
         sigStack.ss_flags = 0;
         sigaltstack(&sigStack, &oldSigStack);
         struct sigaction sa = { };
@@ -6628,7 +6639,7 @@ namespace Catch {
     bool FatalConditionHandler::isSet = false;
     struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {};
     stack_t FatalConditionHandler::oldSigStack = {};
-    char FatalConditionHandler::altStackMem[SIGSTKSZ] = {};
+    char FatalConditionHandler::altStackMem[altStackSize] = {};
 
 } // namespace Catch