Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure we are using volatile correctly #58

Closed
adpaco-aws opened this issue Apr 14, 2021 · 2 comments
Closed

Ensure we are using volatile correctly #58

adpaco-aws opened this issue Apr 14, 2021 · 2 comments
Assignees

Comments

@adpaco-aws
Copy link
Contributor

According to @danielsn:

volatile has two meanings: one is just that we can't reorder or drop the access, which CBMC never does.
It might also mean that reads should return nondet, which we don't currently model.

The code for this would be in intrinsics.rs

celinval referenced this issue in celinval/kani-dev Nov 16, 2021
@adpaco-aws
Copy link
Contributor Author

(Adding comment as part of #727)

Because concurrency is out of scope, volatile instructions should be treated as sequential operations. We should issue a warning when code is generated for them, similar to how we handle atomic intrinsics.

@adpaco-aws
Copy link
Contributor Author

Closing this because now it's clear what is the right meaning for volatile in Kani: Since concurrency is out of scope for now, volatile operations should be treated as their non-volatile counterparts, and as indicated in the original description for the issue reordering is not an issue with CBMC. Note this already being done at least for intrinsics after the general audit in #727, which disabled all volatile intrinsics except for volatile_store.

If we were to tackle concurrency at some point in the future, then volatile operations should be reviewed to ensure proper handling. In my experience, treating volatile reads as nondet (I think there was such an option in CBMC) is certainly going to cause spurious failures in the long run, especially because it's not possible to automatically constrain the values that are being read.

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

No branches or pull requests

2 participants