GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [3.14] gh-149816: fix a race when fetching OpenSSL digests (GH-153019) by picnixz · Pull Request #160006 · python/cpython

Conversation

@picnixz

@picnixz picnixz commented Oct 21, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

(cherry picked from commit 2346981)

  • Issue: 22 free-threading race conditions #149816

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@picnixz
[3.14] pythongh-149816: fix a race when fetching OpenSSL digests (pyt…
ea5a4de
…honGH-153019)

(cherry picked from commit 2346981)

Co-authored-by: Bénédikt Tran <[email protected]>
@picnixz
picnixz requested a review from gpshead as a code owner October 21, 2026 00:15
@bedevere-app bedevere-app Bot mentioned this pull request Oct 21, 2026
gh-149816: fix a race when fetching OpenSSL digests #153019
Merged
@bedevere-app bedevere-app Bot added the sprint label Oct 21, 2026
@github-project-automation github-project-automation Bot added this to Sprint Oct 21, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Sprint Oct 21, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Oct 21, 2026
22 free-threading race conditions #149816
Open
13 of 24 tasks
@bedevere-app bedevere-app Bot added the awaiting core review label Oct 21, 2026
picnixz added 2 commits October 20, 2026 17:15
@picnixz
Update 2026-07-04-12-52-22.gh-issue-149816.XQOutB.rst
65556d7
@picnixz
Update _hashopenssl.c
7adeff0
picnixz
picnixz commented Oct 21, 2026
View reviewed changes
Comment thread Modules/_hashopenssl.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@picnixz
Update Modules/_hashopenssl.c
ceba61d
@picnixz

picnixz commented Oct 21, 2026

Copy link
Copy Markdown
Member Author

!buildbot FIPS

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot

bedevere-bot commented Oct 21, 2026

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @picnixz for commit ceba61d 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F160006%2Fmerge

The command will test the builders whose names match following regular expression: FIPS

The builders matched are:

  • AMD64 CentOS10 FIPS No Builtin Hashes PR
  • AMD64 CentOS9 FIPS Only Blake2 Builtin Hash PR
  • AMD64 CentOS10 FIPS Only Blake2 Builtin Hash PR
  • AMD64 CentOS9 FIPS No Builtin Hashes PR
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@picnixz
picnixz merged commit 3d2f1b2 into python:3.14 Oct 21, 2026
49 of 53 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting core review label Oct 21, 2026
@github-project-automation github-project-automation Bot moved this from Todo to Done in Sprint Oct 21, 2026
@picnixz
picnixz deleted the backport-2346981-3.14 branch October 21, 2026 18:18
hroncok
hroncok reviewed Nov 2, 2026
View reviewed changes
Comment thread Modules/_hashopenssl.c
state->hashtable, (const void*)name
);
py_hashentry_t *entry = _Py_hashtable_get(state->hashtable, name);
int fips = disable_fips_property(py_ht);

@hroncok hroncok Nov 2, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Other branches have:

Suggested change
int fips = disable_fips_property(py_ht);
int fips = !disable_fips_property(py_ht);

This leads to the following regression when comparing 3.14.8 with 3.14.10:

import _hashlib

print("FIPS mode active:", bool(_hashlib.get_fips_mode()))
for usedforsecurity in (True, False):
    try:
        _hashlib.openssl_md5(usedforsecurity=usedforsecurity)
        print(f"usedforsecurity={usedforsecurity:5} -> ALLOWED")
    except ValueError as e:
        print(f"usedforsecurity={usedforsecurity:5} -> BLOCKED ({e})")

3.14.8 (correct):
usedforsecurity=True -> BLOCKED ([digital envelope routines] unsupported)
usedforsecurity=False -> ALLOWED (md5 object constructed)

3.14.10 (broken):
usedforsecurity=True -> ALLOWED (md5 object constructed)
usedforsecurity=False -> BLOCKED ([digital envelope routines] unsupported)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@hroncok hroncok Nov 2, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

#160984

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@picnixz picnixz Nov 2, 2026

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Yes, it's known. I flipped it by mistake :(

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@hroncok hroncok Nov 2, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I commented here first, then looked for a fix before I send it and I found one. Sorry for the noise.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@picnixz picnixz Nov 2, 2026

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

no worry, it's me that is sorry the issue!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@dwoz dwoz mentioned this pull request Nov 2, 2026
Patch CPython 3.14.10 FIPS regression in _hashopenssl.c saltstack/relenv#342
Merged
3 tasks
dwoz added a commit to saltstack/relenv that referenced this pull request Nov 2, 2026
@dwoz
Patch CPython 3.14.10 FIPS regression in _hashopenssl.c (#342)
6f6d67c
CPython 3.14.10 shipped a bad backport of upstream gh-149816 (CPython PR
#160006, merged 2026-10-21). The main-branch fix landed as
``int fips = !disable_fips_property(py_ht);`` in
``Modules/_hashopenssl.c::py_digest_by_name``, but the 3.14 backport
dropped the leading ``!``, inverting the FIPS property polarity:

* ``openssl_md5(usedforsecurity=False)`` under FIPS now fetches MD5
  without the ``-fips`` property filter, so OpenSSL can't find a non-FIPS
  MD5 and the probe raises. hashlib.py's dispatch then falls back to the
  builtin ``_md5`` (compiled in via
  ``--with-builtin-hashlib-hashes=blake2,md5,sha1,sha2,sha3``), which has
  no FIPS awareness and silently returns an MD5 digest.
* Conversely, ``openssl_md5(usedforsecurity=True)`` would fetch with the
  ``-fips`` filter and succeed in FIPS mode via a non-FIPS provider,
  silently bypassing FIPS enforcement.

Caught by ``Test FIPS compatability (3.14, x86_64)`` on PR #338 after the
Python 3.14.9 -> 3.14.10 bump; 3.10-3.13 and 3.14.9 pass, 3.14.10 fails.

Apply the one-character fix as a build-time patch across linux/darwin/
windows. The regex matches the broken form only -- a correctly-fixed
source has ``!disable_fips_property`` and the regex won't match, so this
is idempotent and self-disabling. Remove once a 3.14 point release ships
the real fix.

Refs:
- CPython main fix:   python/cpython@23469818538c
- 3.14 bad backport:  python/cpython#160006
This was referenced Nov 5, 2026
hashlib: usedforsecurity works the wrong way round in FIPS mode in 3.14.10 #161383
Closed
[3.14] gh-161383: Fix inverted FIPS property query in _hashlib #161385
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gpshead gpshead Awaiting requested review from gpshead gpshead is a code owner
1 more reviewer
@hroncok hroncok hroncok left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

sprint

Projects

Sprint
Status: Done

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@picnixz @bedevere-bot @hroncok
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.