Repository navigation
rd: fix concurrent first load of libwolfprov - #516
Open
ColtonWilley wants to merge 1 commit into
Open
ColtonWilley wants to merge 1 commit into
ColtonWilley wants to merge 1 commit into
Conversation
load_wolfprov_and_init published the static DSO before DSO_load() finished, so concurrent first activations in separate libctxs bound an unloaded DSO or freed it under each other. Load into a local DSO and publish it under a lock.
There was a problem hiding this comment.
🟢 Approval recommended
The locking and ownership changes address the reported race without identified blocking issues.
No open issues 🎉
What changed in this PR
Fixes concurrent first-time loading of libwolfprov in replace-default mode by publishing the shared DSO only after loading completes.
Changes:
- Adds a once-initialized lock to protect shared DSO access.
- Loads each candidate DSO locally, publishes it under the lock, and frees redundant candidates.
- Keeps loading outside the lock and preserves retries after load failures.
| File | Description |
|---|---|
patches/provider_predefined.c.replace-default |
Synchronizes DSO publication and safely handles concurrent loaders. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In replace-default mode,
load_wolfprov_and_initpublished its static DSO beforeDSO_load()finished, so threads making their first provider activation in different libctxs could bind an unloaded DSO (provider init fails) or double-free it. The DSO is now loaded locally and published under a lock; failed loads still retry.