]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-131338: Disable computed stack limit checks on non-glibc linux (GH-134336...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 10 Aug 2025 13:55:29 +0000 (15:55 +0200)
committerGitHub <noreply@github.com>
Sun, 10 Aug 2025 13:55:29 +0000 (16:55 +0300)
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>
Misc/NEWS.d/next/Core_and_Builtins/2025-07-25-22-31-52.gh-issue-131338.zJDCMp.rst [new file with mode: 0644]
Python/ceval.c

diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2025-07-25-22-31-52.gh-issue-131338.zJDCMp.rst b/Misc/NEWS.d/next/Core_and_Builtins/2025-07-25-22-31-52.gh-issue-131338.zJDCMp.rst
new file mode 100644 (file)
index 0000000..6c064e8
--- /dev/null
@@ -0,0 +1,2 @@
+Disable computed stack limit checks on non-glibc linux platforms to fix
+crashes on deep recursion.
index 42080f77f2a046f3ab42f7a75ceba15beedb8346..e5b1b82e45e14c09a795c6e286d8bcc19e5d5a02 100644 (file)
@@ -439,7 +439,11 @@ _Py_InitializeRecursionLimits(PyThreadState *tstate)
     _tstate->c_stack_soft_limit = _tstate->c_stack_hard_limit + _PyOS_STACK_MARGIN_BYTES;
 #else
     uintptr_t here_addr = _Py_get_machine_stack_pointer();
-#  if defined(HAVE_PTHREAD_GETATTR_NP) && !defined(_AIX) && !defined(__NetBSD__)
+/// XXX musl supports HAVE_PTHRED_GETATTR_NP, but the resulting stack size
+/// (on alpine at least) is much smaller than expected and imposes undue limits
+/// compared to the old stack size estimation.  (We assume musl is not glibc.)
+#  if defined(HAVE_PTHREAD_GETATTR_NP) && !defined(_AIX) && \
+        !defined(__NetBSD__) && (defined(__GLIBC__) || !defined(__linux__))
     size_t stack_size, guard_size;
     void *stack_addr;
     pthread_attr_t attr;