Repository navigation
Conversation
Avoid reading the old destination for unit-returning atomic stores and mark the written memory initialized using the existing write instrumentation. Preserve the exchange read/return path. Add store/load regressions for integer and pointer values, exchange behavior, and negative checks for uninitialized reads, invalid destinations, and adjacent uninitialized memory.
This branch has not been deployed
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.
Summary
Kani incorrectly checks the destination of a volatile atomic store for prior initialization and fails to mark it as initialized after the write. As a result, a valid store to uninitialized allocated memory is rejected, and a subsequent read also fails its initialization check.
The code generator shared by atomic store and exchange also reads the previous destination value even for stores, although only exchange needs to return it.
Changes
VOLATILEargument istrue. Preserve the existing check for non-volatile stores pending clarification of theirfrom_ptr-based safety contract.Regression tests
Added coverage for:
Validation
Validated against upstream commit
c5e65fdfc3e15ec32293f2a4c07509aebec033c9, using nightly-2026-10-23, CBMC 6.11.0, and x86_64 Linux.Targeted validation:
-Zmiri-recursive-validationflag. This is supplementary evidence, not a definitive resolution of Rust's reference-validity rules.Broader regression results:
scripts/kani-regression.shpassed.Quantifiers/gcd_invariant.rsat 300 seconds. The same test also timed out on the unmodified baseline at 120 seconds. The focused atomic test passed separately.The full regression script stopped at the Kani-suite timeout. Expected and UI were run independently; later suites were not run. These results do not constitute a fully passing regression run.
Scope and limitations
The volatile-store reproducer relies on Rust's raw-pointer
store_volatilesafety contract and uses ordinary allocated memory.The initial reproducer used
VOLATILE=false, but its validity under thefrom_ptr-based safety contract has not been established. This change preserves the existing non-volatile initialization check and does not resolve whether non-volatile atomic stores may initialize uninitialized storage.This change does not implement complete volatile externally observable behavior, MMIO, or concurrency modeling.
Resolves #5114
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.