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

{:concurrent} attribute support in auditor #3463

Closed
robin-aws opened this issue Feb 6, 2023 · 2 comments · Fixed by #3660
Closed

{:concurrent} attribute support in auditor #3463

robin-aws opened this issue Feb 6, 2023 · 2 comments · Fixed by #3660
Assignees
Labels
kind: enhancement Enhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafny part: language definition Relating to the Dafny language definition itself

Comments

@robin-aws
Copy link
Member

Dafny verification is currently based on sequential execution of code. It CAN be safe to concurrently execute the compiled code but only under certain assumptions. For example, the .NET AWS Encryption SDK exposes entry points that are threadsafe because they do not read or write any shared state. This RFC is intended to improve the robustness of this mechanism.

This feature request is the very first baby step towards making Dafny aware of concurrency. We would provide a warning in dafny audit for any Dafny program element with a body (constructors, methods, and functions?) annotated with {:concurrent}. The attribute would be a way to document the fact that the code will be used in a concurrent setting, so that the auditor can point out this assumption. The suggested mitigation would be something like "target language concurrent testing and manual review", since Dafny can't yet offer any better.

Later on we could provide more options to make Dafny happy without any warnings. The RFC above would make this warning go away if the attributed element had both reads {} and (often implicitly) modifies {}. Even later on when Dafny has language features to support concurrent execution, there would be ways to synchronize so that arbitrary logic could be proven correct even under concurrent execution.

Calling this a language definition change even though the initial change would only be in the auditor, since it would still be establishing semantics that interact with future language features.

@robin-aws robin-aws added kind: enhancement Enhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafny part: language definition Relating to the Dafny language definition itself labels Feb 6, 2023
@robin-aws
Copy link
Member Author

It might be even better to be clear that the only supported form of this initially would be essentially an {:axiom}. I'm not sure what syntax is best though - I'm not a huge fan of {:concurrent "axiom"}. If we were using this syntax suggested in #3149 I would suggest @Concurrent(axiom := true). {:concurrent true} is not good because it mixes up whether the concurrent-safe requirement is on or off at all with whether it is proven or assumed.

@RustanLeino
Copy link
Collaborator

Yeah, at this time, this seems like a feature of the auditor. It's seems fine to me for the auditor to give the attribute the name {:concurrent}.

@atomb atomb self-assigned this Feb 7, 2023
atomb added a commit that referenced this issue Mar 13, 2023
Adds support to `dafny audit` for reporting instances of the
`{:concurrent}` attribute, intended to mark code that should be
safe for use in concurrent settings.

Fixes #3463

<small>By submitting this pull request, I confirm that my contribution
is made under the terms of the [MIT
license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt).</small>

---------

Co-authored-by: Robin Salkeld <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: enhancement Enhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafny part: language definition Relating to the Dafny language definition itself
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants