Skip to content

Commit 06c1da1

Browse files
vstinnermcepl
authored andcommitted
00343: Fix test_faulthandler on GCC 10
bpo-21131: Fix faulthandler.register(chain=True) stack (pythonGH-15276) https://bugs.python.org/issue21131 python@ac827ed
1 parent 2b2ab0e commit 06c1da1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Modules/faulthandler.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,11 @@ int _PyFaulthandler_Init(void)
13291329
* be able to allocate memory on the stack, even on a stack overflow. If it
13301330
* fails, ignore the error. */
13311331
stack.ss_flags = 0;
1332-
stack.ss_size = SIGSTKSZ;
1332+
/* bpo-21131: allocate dedicated stack of SIGSTKSZ*2 bytes, instead of just
1333+
SIGSTKSZ bytes. Calling the previous signal handler in faulthandler
1334+
signal handler uses more than SIGSTKSZ bytes of stack memory on some
1335+
platforms. */
1336+
stack.ss_size = SIGSTKSZ * 2;
13331337
stack.ss_sp = PyMem_Malloc(stack.ss_size);
13341338
if (stack.ss_sp != NULL) {
13351339
err = sigaltstack(&stack, &old_stack);

0 commit comments

Comments
 (0)