Skip to content

Conversation

@miss-islington
Copy link
Contributor

cert_store_stats and get_ca_certs query the SSLContext's X509_STORE with
X509_STORE_get0_objects, but reading the result requires a lock. See
openssl/openssl#23224 for details.

Instead, use X509_STORE_get1_objects, newly added in that PR.
X509_STORE_get1_objects does not exist in current OpenSSLs, but we can
polyfill it with X509_STORE_lock and X509_STORE_unlock.

  • Work around const-correctness problem

  • Add missing X509_STORE_get1_objects failure check

  • Add blurb
    (cherry picked from commit bce6931)

Co-authored-by: David Benjamin [email protected]

…thonGH-114573)

* pythongh-114572: Fix locking in cert_store_stats and get_ca_certs

cert_store_stats and get_ca_certs query the SSLContext's X509_STORE with
X509_STORE_get0_objects, but reading the result requires a lock. See
openssl/openssl#23224 for details.

Instead, use X509_STORE_get1_objects, newly added in that PR.
X509_STORE_get1_objects does not exist in current OpenSSLs, but we can
polyfill it with X509_STORE_lock and X509_STORE_unlock.

* Work around const-correctness problem

* Add missing X509_STORE_get1_objects failure check

* Add blurb
(cherry picked from commit bce6931)

Co-authored-by: David Benjamin <[email protected]>
@sethmlarson
Copy link
Contributor

The failure on OpenSSL 3.1.3 doesn't seem related to this PR as it's happening on the 3.10 branch as well. Trying to figure out why we're seeing the new failures.

@sethmlarson
Copy link
Contributor

3.10 branch appears to be failing on OpenSSL 3.1.3, so I don't think that failure is related to this PR: https://github.com/python/cpython/actions/runs/7961486528/job/21732837870

@pablogsal
Copy link
Member

3.10 branch appears to be failing on OpenSSL 3.1.3, so I don't think that failure is related to this PR: https://github.com/python/cpython/actions/runs/7961486528/job/21732837870

I took a look and I agree that merging this looks safe so I will go ahead and do it.

@pablogsal pablogsal merged commit 37324b4 into python:3.10 Feb 20, 2024
gentoo-bot pushed a commit to gentoo/cpython that referenced this pull request May 21, 2024
…rts (pythonGH-114573) (python#115548)

pythongh-114572: Fix locking in cert_store_stats and get_ca_certs (pythonGH-114573)

* pythongh-114572: Fix locking in cert_store_stats and get_ca_certs

cert_store_stats and get_ca_certs query the SSLContext's X509_STORE with
X509_STORE_get0_objects, but reading the result requires a lock. See
openssl/openssl#23224 for details.

Instead, use X509_STORE_get1_objects, newly added in that PR.
X509_STORE_get1_objects does not exist in current OpenSSLs, but we can
polyfill it with X509_STORE_lock and X509_STORE_unlock.

* Work around const-correctness problem

* Add missing X509_STORE_get1_objects failure check

* Add blurb
(cherry picked from commit bce6931)

Co-authored-by: David Benjamin <[email protected]>
gentoo-bot pushed a commit to gentoo/cpython that referenced this pull request May 21, 2024
…rts (pythonGH-114573) (python#115548)

pythongh-114572: Fix locking in cert_store_stats and get_ca_certs (pythonGH-114573)

* pythongh-114572: Fix locking in cert_store_stats and get_ca_certs

cert_store_stats and get_ca_certs query the SSLContext's X509_STORE with
X509_STORE_get0_objects, but reading the result requires a lock. See
openssl/openssl#23224 for details.

Instead, use X509_STORE_get1_objects, newly added in that PR.
X509_STORE_get1_objects does not exist in current OpenSSLs, but we can
polyfill it with X509_STORE_lock and X509_STORE_unlock.

* Work around const-correctness problem

* Add missing X509_STORE_get1_objects failure check

* Add blurb
(cherry picked from commit bce6931)

Co-authored-by: David Benjamin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Development

Successfully merging this pull request may close these issues.

4 participants