Blame SOURCES/00333-fix-faulthandler-stack.patch

4f4dad
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
4f4dad
index 890c645..ccab553 100644
4f4dad
--- a/Modules/faulthandler.c
4f4dad
+++ b/Modules/faulthandler.c
4f4dad
@@ -1333,7 +1333,11 @@ int _PyFaulthandler_Init(void)
4f4dad
      * be able to allocate memory on the stack, even on a stack overflow. If it
4f4dad
      * fails, ignore the error. */
4f4dad
     stack.ss_flags = 0;
4f4dad
-    stack.ss_size = SIGSTKSZ;
4f4dad
+    /* bpo-21131: allocate dedicated stack of SIGSTKSZ*2 bytes, instead of just
4f4dad
+       SIGSTKSZ bytes. Calling the previous signal handler in faulthandler
4f4dad
+       signal handler uses more than SIGSTKSZ bytes of stack memory on some
4f4dad
+       platforms. */
4f4dad
+    stack.ss_size = SIGSTKSZ * 2;
4f4dad
     stack.ss_sp = PyMem_Malloc(stack.ss_size);
4f4dad
     if (stack.ss_sp != NULL) {
4f4dad
         err = sigaltstack(&stack, &old_stack);