29 lines
1.3 KiB
Diff
29 lines
1.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Victor Stinner <vstinner@python.org>
|
|
Date: Fri, 19 Jun 2020 17:16:05 +0200
|
|
Subject: [PATCH] 00343: Fix test_faulthandler on GCC 10
|
|
|
|
bpo-21131: Fix faulthandler.register(chain=True) stack (GH-15276)
|
|
https://bugs.python.org/issue21131
|
|
https://github.com/python/cpython/commit/ac827edc493d3ac3f5b9b0cc353df1d4b418a9aa
|
|
---
|
|
Modules/faulthandler.c | 6 +++++-
|
|
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
|
|
index 3e0a7b127d..fac662afc3 100644
|
|
--- a/Modules/faulthandler.c
|
|
+++ b/Modules/faulthandler.c
|
|
@@ -1329,7 +1329,11 @@ int _PyFaulthandler_Init(void)
|
|
* be able to allocate memory on the stack, even on a stack overflow. If it
|
|
* fails, ignore the error. */
|
|
stack.ss_flags = 0;
|
|
- stack.ss_size = SIGSTKSZ;
|
|
+ /* bpo-21131: allocate dedicated stack of SIGSTKSZ*2 bytes, instead of just
|
|
+ SIGSTKSZ bytes. Calling the previous signal handler in faulthandler
|
|
+ signal handler uses more than SIGSTKSZ bytes of stack memory on some
|
|
+ platforms. */
|
|
+ stack.ss_size = SIGSTKSZ * 2;
|
|
stack.ss_sp = PyMem_Malloc(stack.ss_size);
|
|
if (stack.ss_sp != NULL) {
|
|
err = sigaltstack(&stack, &old_stack);
|