-
Notifications
You must be signed in to change notification settings - Fork 100
Add kani in ci + kani proof for conformance to 2.7.7.2 section #338
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
base: main
Are you sure you want to change the base?
Conversation
@priyasiddharth thanks for this PR. IIUC you are re-working a patch initially developed from @MatiasVara, so I think you should add also your S-o-b in the patch. |
Thank you @stefano-garzarella for the taking on the review. I have added a sign-off tag. |
f915258
to
6ac82d5
Compare
@stefano-garzarella PTAL |
@priyasiddharth please mention big changes (e.g. you included patch from #339) and the reason after a push. I think that should also be mentioned in the PR description/title. Also we usually squash new changes in commit, so all the "fix(comment)..." commit, should be squashed in the first commit (you can remove my Maybe we can also change the order of the patches, first enable the CI, then add the first test. |
Run kani as a part of the CI pipeline. In particular, run the proofs for virtio-queue. In some cases, kani may not finish so set a twenty minutes timeout. Signed-off-by: Matias Ezequiel Vara Larsen <[email protected]> Signed-off-by: Siddharth Priya <[email protected]>
Add the verify_spec_2_7_7_2() proof to verify that the implementation of queue satisfies 2.7.7.2 requirement. The proof relies on whether the EVENT_IDX feature has been negotiated. Conversely with `test_needs_notification()` test, this proof `tests` for all possible values of the queue structure. Signed-off-by: Matias Ezequiel Vara Larsen <[email protected]> Signed-off-by: Siddharth Priya <[email protected]>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just very minimal comments! Thanks!
@@ -23,6 +23,19 @@ criterion = "0.6.0" | |||
vm-memory = { workspace = true, features = ["backend-mmap", "backend-atomic"] } | |||
memoffset = "0.9.0" | |||
|
|||
# The following deps are needed only under kani |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we can remove this comment, it isn't adding any information more than the following code.
Just a suggestion for the future, use comments more to explain the reason, the "why" of code/configuration or to explain unclear part. In this case the section is very clear and the comment will not add more.
use std::mem::ManuallyDrop; | ||
use vm_memory::MmapRegion; | ||
|
||
use std::num::Wrapping; | ||
use vm_memory::FileOffset; | ||
|
||
use vm_memory::{GuestMemoryRegion, MemoryRegionAddress}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: try to group dependencies better (e.g. first std inclusion, then external crates):
use std::mem::ManuallyDrop; | |
use vm_memory::MmapRegion; | |
use std::num::Wrapping; | |
use vm_memory::FileOffset; | |
use vm_memory::{GuestMemoryRegion, MemoryRegionAddress}; | |
use std::mem::ManuallyDrop; | |
use std::num::Wrapping; | |
use vm_memory::{FileOffset, GuestMemoryRegion, MemoryRegionAddress, MmapRegion}; |
Enable Kani in the CI and add the verify_spec_2_7_7_2() proof to verify that the implementation of queue satisfies 2.7.7.2 requirement. The proof relies on whether the EVENT_IDX feature has been negotiated. Conversely with
test_needs_notification()
test, this prooftests
for all possible values of the queue structure.Summary of the PR
This is review-ready version of #324 and #339.
First, we add Kani to the CI pipeline with a timeout of 20 minutes. The timeout is essential because Kani converts a rust program to a
SAT
problem which isNP-complete
and may not return in a reasonable time.Second, we add a kani proof to meet the requirements outlined in 2.7.7.2 of the virtio specification regarding the notification suppression mechanism. We have sketched this proof from the same proof defined for the queue implemented in firecraker. This commit adds the verify_spec_2_7_7_2() proof to verify that the implementation of queue meets 2.7.7.2 requirement. The proof relies on whether the EVENT_IDX feature has been negotiated. Conversely with test_needs_notification() test, this proof tests for all possible values of queue. To run the proof, you can run:
The proof currently passes with kani
v0.62.0
:Requirements
Before submitting your PR, please make sure you addressed the following
requirements:
git commit -s
), and the commit message has max 60 characters for thesummary and max 75 characters for each description line.
test.
Release" section of CHANGELOG.md (if no such section exists, please create one).
unsafe
code is properly documented.