fixed use after free with detached cpp metrics pages#413
Open
cherep58 wants to merge 2 commits into
Open
Conversation
gshigin
approved these changes
Jul 20, 2026
Add comments capturing the invariants the detached-page retention scheme relies on, and a compile-time guard for the shared struct layout: - cppbridge.CppMetric: note it is a memory view over C++ Go::Metric (not a copy) and that 'active' is the cross-language handshake gating reclamation. - Range(): explain why the loop keeps iterating after a consumer returns false (per-generation stamping drives cache pruning) and what the prune loop does. - The finalizer: spell out why the page is guaranteed alive when it writes 'active' and why there is no ABA, plus the GC-latency tradeoff. - MetricsPageList::remove_unused_pages(): document that it is the only place pages are freed and runs solely under the Go mutex, while the finalizer only flips the atomic flag. - Go::Metric: add static_asserts on size/offsets so a future field change fails the build instead of silently corrupting the Go-mapped memory (LP64). Co-authored-by: Cursor <cursoragent@cursor.com>
vporoshok
approved these changes
Jul 20, 2026
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.
No description provided.