https://github.com/python/cpython/commit/f37e82139a24c4f1bd84c7d9111f44719b94fff5
commit: f37e82139a24c4f1bd84c7d9111f44719b94fff5
branch: main
author: Serhiy Storchaka <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2026-10-20T20:28:55+03:00
summary:

gh-143632: Fix the musl check for PR_SET_VMA_ANON_NAME (GH-159886)

The guard added by gh-143730 tested $ac_cv_libc, which is never set, so the
check always ran and the build could fail on the struct prctl_mm_map
redefinition it was meant to avoid.  Match on the host triplet instead.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>

files:
A Misc/NEWS.d/next/Build/2026-10-20-17-50-00.gh-issue-143632.PrCtlM.rst
M configure
M configure.ac

diff --git 
a/Misc/NEWS.d/next/Build/2026-10-20-17-50-00.gh-issue-143632.PrCtlM.rst 
b/Misc/NEWS.d/next/Build/2026-10-20-17-50-00.gh-issue-143632.PrCtlM.rst
new file mode 100644
index 00000000000000..5a2c7b8208cd36
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2026-10-20-17-50-00.gh-issue-143632.PrCtlM.rst
@@ -0,0 +1,3 @@
+Fix the check that disables ``PR_SET_VMA_ANON_NAME`` on musl libc: it tested
+an unset variable, so it never had any effect and the build could fail with
+a redefinition of ``struct prctl_mm_map``.
diff --git a/configure b/configure
index 72948d6ba4fb43..607f43db23360d 100755
--- a/configure
+++ b/configure
@@ -25553,12 +25553,14 @@ printf "%s\n" "#define HAVE_UT_NAMESIZE 1" 
>>confdefs.h
 
 fi
 
-# musl libc redefines struct prctl_mm_map and conflicts with linux/prctl.h
-if test "$ac_cv_libc" != musl
-then :
-
-ac_fn_check_decl "$LINENO" "PR_SET_VMA_ANON_NAME" 
"ac_cv_have_decl_PR_SET_VMA_ANON_NAME" "#include <linux/prctl.h>
-               #include <sys/prctl.h>
+# musl libc redefines struct prctl_mm_map and conflicts with linux/prctl.h.
+# The conftest does not reliably catch this, so skip the check on musl.
+case $host in #(
+  *-musl*) :
+     ;; #(
+  *) :
+    ac_fn_check_decl "$LINENO" "PR_SET_VMA_ANON_NAME" 
"ac_cv_have_decl_PR_SET_VMA_ANON_NAME" "#include <linux/prctl.h>
+                 #include <sys/prctl.h>
 " "$ac_c_undeclared_builtin_options" "CFLAGS"
 if test "x$ac_cv_have_decl_PR_SET_VMA_ANON_NAME" = xyes
 then :
@@ -25575,8 +25577,8 @@ printf "%s\n" "#define _Py_HAVE_PR_SET_VMA_ANON_NAME 1" 
>>confdefs.h
 
 fi
 
-
-fi
+ ;;
+esac
 # check for openpty, login_tty, and forkpty
 
 
diff --git a/configure.ac b/configure.ac
index b8f5e2b3d5dd40..775b8b4e603877 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6008,15 +6008,17 @@ AC_CHECK_DECLS([UT_NAMESIZE],
                          [Define if you have the 'HAVE_UT_NAMESIZE' 
constant.])],
               [],
               [@%:@include <utmp.h>])
-# musl libc redefines struct prctl_mm_map and conflicts with linux/prctl.h
-AS_IF([test "$ac_cv_libc" != musl], [
-AC_CHECK_DECLS([PR_SET_VMA_ANON_NAME],
-              [AC_DEFINE([_Py_HAVE_PR_SET_VMA_ANON_NAME], [1],
-                         [Define if you have the 'PR_SET_VMA_ANON_NAME' 
constant.])],
-              [],
-              [@%:@include <linux/prctl.h>
-               @%:@include <sys/prctl.h>])
-])
+# musl libc redefines struct prctl_mm_map and conflicts with linux/prctl.h.
+# The conftest does not reliably catch this, so skip the check on musl.
+AS_CASE([$host],
+  [*-musl*], [],
+  [AC_CHECK_DECLS([PR_SET_VMA_ANON_NAME],
+                [AC_DEFINE([_Py_HAVE_PR_SET_VMA_ANON_NAME], [1],
+                           [Define if you have the 'PR_SET_VMA_ANON_NAME' 
constant.])],
+                [],
+                [@%:@include <linux/prctl.h>
+                 @%:@include <sys/prctl.h>])]
+)
 # check for openpty, login_tty, and forkpty
 
 AC_CHECK_FUNCS([openpty], [],

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to