Skip to content

gh-121996: Introduce ./configure --disable-openssf-guide option #121997

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Doc/using/configure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,16 @@ Security Options
The settings ``python`` and *STRING* also set TLS 1.2 as minimum
protocol version.

.. option:: --disable-openssf-guide=[yes|no|default=yes]

Disable compiler options that are recommended by `OpenSSF`_ for security reasons.
If this option is not enabled, CPython will be build based on the `OpenSSF`_ compiler option guides.

.. _OpenSSF: https://openssf.org/

.. versionadded:: 3.14


macOS Options
-------------

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Introduce ./configure --disable-openssf-guide option. Patch by Donghee Na.
31 changes: 28 additions & 3 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 13 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2458,9 +2458,19 @@ AS_VAR_IF([with_strict_overflow], [yes],

# Enable flags that warn and protect for potential security vulnerabilities.
# These flags should be enabled by default for all builds.
AX_CHECK_COMPILE_FLAG([-fstack-protector-strong], [BASECFLAGS="$BASECFLAGS -fstack-protector-strong"], [AC_MSG_WARN([-fstack-protector-strong not supported])], [-Werror])
AX_CHECK_COMPILE_FLAG([-Wtrampolines], [BASECFLAGS="$BASECFLAGS -Wtrampolines"], [AC_MSG_WARN([-Wtrampolines not supported])], [-Werror])
AX_CHECK_COMPILE_FLAG([-D_FORTIFY_SOURCE=3], [BASECFLAGS="$BASECFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3"], [AC_MSG_WARN([-D_FORTIFY_SOURCE=3 not supported])])

AC_MSG_CHECKING([for --disable-openssf-guide])
AC_ARG_ENABLE([openssf_guide],
[AS_HELP_STRING([--disable-openssf-guide], [disable usage of the security compiler options (default is no)])],
[AS_VAR_IF([enable_openssf_guide], [yes], [disable_openssf_guide=no], [disable_openssf_guide=yes])], [disable_openssf_guide=no])
AC_MSG_RESULT([$disable_openssf_guide])

if test "$disable_openssf_guide" = "no"
then
AX_CHECK_COMPILE_FLAG([-fstack-protector-strong], [BASECFLAGS="$BASECFLAGS -fstack-protector-strong"], [AC_MSG_WARN([-fstack-protector-strong not supported])], [-Werror])
AX_CHECK_COMPILE_FLAG([-Wtrampolines], [BASECFLAGS="$BASECFLAGS -Wtrampolines"], [AC_MSG_WARN([-Wtrampolines not supported])], [-Werror])
AX_CHECK_COMPILE_FLAG([-D_FORTIFY_SOURCE=3], [BASECFLAGS="$BASECFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3"], [AC_MSG_WARN([-D_FORTIFY_SOURCE=3 not supported])])
fi

case $GCC in
yes)
Expand Down
Loading