Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Cope with non-const SIGSTKSZ.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 18 Feb 2021 09:00:09 +0000 (10:00 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 18 Feb 2021 09:09:51 +0000 (10:09 +0100)
See https://sourceware.org/git/?p=glibc.git;a=commit;h=6c57d320484988e87e446e2e60ce42816bf51d53.

src/kernel/context/Context.cpp
src/simix/smx_global.cpp

index dbd49f7..10056c7 100644 (file)
@@ -11,7 +11,7 @@
 #include "src/simix/smx_private.hpp"
 #include "src/surf/surf_interface.hpp"
 
-#include <array>
+#include <vector>
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_context);
 
@@ -29,7 +29,9 @@ thread_local Context* Context::current_context_ = nullptr;
 /* Install or disable alternate signal stack, for SIGSEGV handler. */
 int Context::install_sigsegv_stack(stack_t* old_stack, bool enable)
 {
-  static std::array<unsigned char, SIGSTKSZ> sigsegv_stack;
+  static std::vector<unsigned char> sigsegv_stack;
+  if (sigsegv_stack.size() == 0)
+    sigsegv_stack.resize(SIGSTKSZ);
   stack_t stack;
   stack.ss_sp    = sigsegv_stack.data();
   stack.ss_size  = sigsegv_stack.size();
index fe14085..b8a4412 100644 (file)
@@ -88,8 +88,6 @@ static void segvhandler(int signum, siginfo_t* siginfo, void* /*context*/)
   std::raise(signum);
 }
 
-std::array<unsigned char, SIGSTKSZ> sigsegv_stack; /* alternate stack for SIGSEGV handler */
-
 /**
  * Install signal handler for SIGSEGV.  Check that nobody has already installed
  * its own handler.  For example, the Java VM does this.