Skip to content

gh-112301: Update disable safety and enable slow safety configure options documentation - #122758

Merged
AA-Turner merged 3 commits into
python:mainfrom
nohlson:update-compiler-options-documentation
Aug 8, 2024
Merged

gh-112301: Update disable safety and enable slow safety configure options documentation#122758
AA-Turner merged 3 commits into
python:mainfrom
nohlson:update-compiler-options-documentation

Conversation

@nohlson

@nohlsonnohlson commented Aug 6, 2024

Copy link
Copy Markdown
Contributor

These changes add more information to docs related to the new configure options --disable-safety and --enable-slow-safety. Links in docs point directly to the OpenSSF guidance for particular compiler options suggested in this comment.


📚 Documentation preview 📚: https://cpython-previews--122758.org.readthedocs.build/

Comment threadDoc/using/configure.rst Outdated
@@ -911,17 +911,31 @@ Security Options

Disable compiler options that are recommended by `OpenSSF`_ for security reasons with no performance overhead.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Disable compiler options that are recommended by `OpenSSF`_ for security reasons with no performance overhead.
Disable compiler options that are `recommended by OpenSSF`_ for security reasons with no performance overhead.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expanded link text

Comment threadDoc/using/configure.rst Outdated
* `-fstack-protector-strong`_: Enable run-time checks for stack-based buffer overflows.
* `-Wtrampolines`_: Enable warnings about trampolines that require executable stacks.

.. _OpenSSF: https://github.com/ossf/wg-best-practices-os-developers/blob/main/docs/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.md

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.. _OpenSSF: https://github.com/ossf/wg-best-practices-os-developers/blob/main/docs/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.md
.. _recommended by OpenSSF: https://github.com/ossf/wg-best-practices-os-developers/blob/main/docs/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.md

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed link text

Comment threadDoc/using/configure.rst Outdated
When this option is enabled, CPython will not be built with the compiler options listed below.

.. _OpenSSF: https://openssf.org/
Compiler options that are disabled with this option:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Compiler options that are disabled with this option:
The following compiler options are disabled with :option:`!--disable-safety`:

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-worded sentence

Comment threadDoc/using/configure.rst Outdated
If this option is not enabled, CPython will not be built based on safety compiler options which performance impact.
When this option is enabled, CPython will be built with the compiler options listed below.

Compiler options that are enabled with this option:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Compiler options that are enabled with this option:
The following compiler options are enabled with :option:`!--enable-slower-safety`:

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-worded sentence

Comment threadDoc/using/configure.rst Outdated
* `-D_FORTIFY_SOURCE=3`_: Fortify sources with compile- and run-time checks for unsafe libc usage and buffer overflows.

.. _OpenSSF: https://openssf.org/
.. _OpenSSF: https://github.com/ossf/wg-best-practices-os-developers/blob/main/docs/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.md

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to (and shouldn't) redefine link targets in the same document

Suggested change
.. _OpenSSF: https://github.com/ossf/wg-best-practices-os-developers/blob/main/docs/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.md

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed superfluous link

Comment threadDoc/using/configure.rst Outdated

.. option:: --enable-slower-safety

Enable compiler options that are recommended by `OpenSSF`_ for security reasons which require overhead.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Enable compiler options that are recommended by `OpenSSF`_ for security reasons which require overhead.
Enable compiler options that are `recommended by OpenSSF`_ for security reasons which require overhead.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expanded link text

@corona10corona10 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we introduce the options here, too? or separate PR?
https://github.com/python/cpython/blob/main/Doc/whatsnew/3.14.rst

@corona10corona10 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm from the view of non-native speaker :)

@nohlson

Copy link
Copy Markdown
ContributorAuthor

Can we introduce the options here, too? or separate PR? https://github.com/python/cpython/blob/main/Doc/whatsnew/3.14.rst

We could probably do a separate PR. We will be enabling strictly warning options once the devguide is updated that can be included there as well.

@AA-Turner
AA-Turner merged commit aab18f4 into python:mainAug 8, 2024
@AA-Turner

Copy link
Copy Markdown
Member

@nohlson does this need backports?

A

@nohlson

Copy link
Copy Markdown
ContributorAuthor

@nohlson does this need backports?

A

No we do not need to backport these changes

blhsing pushed a commit to blhsing/cpython that referenced this pull request Aug 22, 2024
…ble-safety`` and ``--enable-slower-safety``) (python#122758)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docsDocumentation in the Doc dirskip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@nohlson@AA-Turner@corona10