fix(curl): statically initialize linked function table - #2015
Open
jpnurmi wants to merge 2 commits into
Open
Conversation
The linked curl path populated g_curl on every SDK initialization. Options can outlive sentry_close() through references held by telemetry producers, allowing a previous curl client to be freed concurrently with the next initialization. This raced teardown reads of easy_cleanup and global_cleanup against writes to the same function pointers. Initialize the linked table at compile time and make it immutable. The runtime-loaded path is not subject to this race. After its first successful symbol resolution, g_curl.handle remains set for the process lifetime, so later initializations return without rewriting the table. Resolution failures occur before a client can use the resolved entries.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2015 +/- ##
==========================================
+ Coverage 74.32% 74.34% +0.02%
==========================================
Files 104 104
Lines 26477 26465 -12
Branches 4821 4821
==========================================
- Hits 19679 19676 -3
+ Misses 5456 5437 -19
- Partials 1342 1352 +10 🚀 New features to boost your workflow:
|
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.
Initialize the linked function table at compile time and make it immutable.
The linked curl path populated
g_curlon every SDK initialization. Options can outlivesentry_close()through references held by telemetry producers, allowing a previous curl client to be freed concurrently with the next initialization. This raced teardown reads ofeasy_cleanupandglobal_cleanupagainst writes to the same function pointers:The runtime-loaded path is not subject to this race. After its first successful symbol resolution,
g_curl.handleremains set for the process lifetime, so later initializations return without rewriting the table. Resolution failures occur before a client can use the resolved entries.