Skip to content

Commit ab95fed

Browse files
bitdancerkumaraditya303vstinner
authored andcommitted
pythongh-131338: Disable computed stack limit checks on non-glibc linux (pythonGH-134336)
(cherry picked from commit 1e9b8f2) Co-authored-by: R. David Murray <rdmurray@bitdance.com> Co-authored-by: Kumar Aditya <kumaraditya@python.org> Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent 47a2109 commit ab95fed

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Disable computed stack limit checks on non-glibc linux platforms to fix
2+
crashes on deep recursion.

Python/ceval.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,11 @@ _Py_InitializeRecursionLimits(PyThreadState *tstate)
439439
_tstate->c_stack_soft_limit = _tstate->c_stack_hard_limit + _PyOS_STACK_MARGIN_BYTES;
440440
#else
441441
uintptr_t here_addr = _Py_get_machine_stack_pointer();
442-
# if defined(HAVE_PTHREAD_GETATTR_NP) && !defined(_AIX) && !defined(__NetBSD__)
442+
/// XXX musl supports HAVE_PTHRED_GETATTR_NP, but the resulting stack size
443+
/// (on alpine at least) is much smaller than expected and imposes undue limits
444+
/// compared to the old stack size estimation. (We assume musl is not glibc.)
445+
# if defined(HAVE_PTHREAD_GETATTR_NP) && !defined(_AIX) && \
446+
!defined(__NetBSD__) && (defined(__GLIBC__) || !defined(__linux__))
443447
size_t stack_size, guard_size;
444448
void *stack_addr;
445449
pthread_attr_t attr;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy