Ensure that HACL* states are not read concurrently #155835
Copy link
Copy link
Closed
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
Sometimes, it's possible to read an HACL* state concurrently:
- sha3 reads the live HACL state outside the object lock at six sites
- blake2's digest_size getter reads the live HACL state outside the lock
Instead, we can (1) add this static information just after construction (2) compute it inside the lock sections. The problem is that HACL* update() functions update the entire state so reading static information is unsafe.
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
- gh-155835: fix
digest_sizeandblock_sizedata races on SHA-3 objects #155838 - gh-155835: fix
digest_sizedata race on BLAKE-2 objects #155839 - [3.15] gh-155835: fix
digest_sizeandblock_sizedata races on SHA-3 objects (GH-155838) #157038 - [3.14] gh-155835: fix
digest_sizeandblock_sizedata races on SHA-3 objects (GH-155838) #157039 - [3.13] gh-155835: fix
digest_sizeandblock_sizedata races on SHA-3 objects (GH-155838) #157041
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Activity
pythongh-155835: fix `digest_size` and `block_size` data races on SHA…
pythongh-155835: fix `digest_size` and `block_size` data races on SHA…
pythongh-155835: fix `digest_size` and `block_size` data races on SHA…
pythongh-155835: fix `digest_size` data race on BLAKE-2 objects
gh-155835: fix `digest_size` and `block_size` data races on SHA-3 obj…
gh-155835: fix `digest_size` data race on BLAKE-2 objects (#155839)
pythongh-155835: fix `digest_size` and `block_size` data races on SHA…
pythongh-155835: fix `digest_size` data race on BLAKE-2 objects (pyth…
[3.13] gh-155835: fix `digest_size` and `block_size` data races on SH…
[3.15] gh-155835: fix `digest_size` and `block_size` data races on SH…
[3.14] gh-155835: fix `digest_size` and `block_size` data races on SH…