From ff9f00304e2e447a947605b9ec44a013c0f4bf00 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Tue, 20 Oct 2026 20:28:55 +0300 Subject: [PATCH] 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. (cherry picked from commit f37e82139a24c4f1bd84c7d9111f44719b94fff5) Co-authored-by: Serhiy Storchaka Co-authored-by: Claude Opus 5 (1M context) --- ...-10-20-17-50-00.gh-issue-143632.PrCtlM.rst | 3 +++ configure | 18 +++++++++-------- configure.ac | 20 ++++++++++--------- 3 files changed, 24 insertions(+), 17 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2026-10-20-17-50-00.gh-issue-143632.PrCtlM.rst 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 000000000000000..5a2c7b8208cd363 --- /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 cab5ab8d2820391..11e43108ed12100 100755 --- a/configure +++ b/configure @@ -24708,12 +24708,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 - #include +# 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 + #include " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_PR_SET_VMA_ANON_NAME" = xyes then : @@ -24730,8 +24732,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 89d879a4c613e1c..26f603e6232acf9 100644 --- a/configure.ac +++ b/configure.ac @@ -5860,15 +5860,17 @@ AC_CHECK_DECLS([UT_NAMESIZE], [Define if you have the 'HAVE_UT_NAMESIZE' constant.])], [], [@%:@include ]) -# 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 - @%:@include ]) -]) +# 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 + @%:@include ])] +) # check for openpty, login_tty, and forkpty AC_CHECK_FUNCS([openpty], [],