Skip to content

rust-engine: keep interned values at stable addresses - #2302

Draft
karthikbhargavan wants to merge 1 commit into
mainfrom
fix/interning-stable-addresses
Draft

karthikbhargavan wants to merge 1 commit into
mainfrom
fix/interning-stable-addresses

Conversation

@karthikbhargavan

Copy link
Copy Markdown
Contributor

Interned::get turns a reference into the interning table's Vec into &'static T with transmute. ConcreteId::from_global_id and TupleId::as_concreteid keep these references in thread-local caches. When the table grows and the Vec reallocates, the cached references point into freed memory: either a panic in interning.rs or, silently, the wrong identifier.

Each interned value is now stored in its own leaked allocation, and get returns the stored reference without transmute.

Reproduce: cd tests && MallocScribble=1 cargo hax into proverif (macOS).
Test: interning::tests::references_survive_table_growth.

- store each interned value in its own leaked allocation
- return the stored reference from get, without transmute
- add a test that references survive table growth
@github-actions github-actions Bot added the stale label Dec 3, 2026
@pereq-dev pereq-dev deleted a comment from github-actions Bot Dec 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants