Skip to content

Ensure we are using volatile correctly #58

Closed

Description

@adpaco

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

Activity

  1. added a commit that references this issue on Nov 16, 2021
  2. adpaco commented on Feb 1, 2022

    @adpaco
    ContributorAuthor

    (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.

  3. adpaco commented on Apr 27, 2022

    @adpaco
    ContributorAuthor

    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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions