-
Notifications
You must be signed in to change notification settings - Fork 33
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
Contracts & Harnesses for add
, addr
, and align_offset
#105
Conversation
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.
First round of comments.
Update: resolved previous comments and successfully used
|
You probably need to update the Kani version you're using. There's now a script that automates this process (https://github.com/model-checking/verify-rust-std/blob/main/scripts/run-kani.sh). If you run it, it should pull the correct Kani version. |
I'm using kani built from source and also pulled the most recent changes from the kani repo and the error persisted. |
Did you run it from the root directory of the |
@zhassan-aws The first time I ran I got
So I entered the unlink command and re-ran the script but got:
My kani is built in ~/Desktop/kani. |
@QinyuanWu Try deleting the |
@carolynzech Debugged live with @zhassan-aws and resolved by manually re-building kani from the source. The run-kani script is having issue due to outdated cbmc-viewer installation that's still in the setup script of the kani repo and should be removed. Thanks! |
Addressed previous PR comments and re-ran kani with successful verification:
|
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.
Looks good!
It seems that the stdarch
directory was accidentally updated. Can you revert the changes to it?
@zhassan-aws Done! Waiting for review from another team member. |
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.
Thank you. I added a few suggestions but not blockers
@zhassan-aws I just started to experience kani compiler error without any modification to the previous code:
Not sure if this is the same issue with PR #127 |
Can you try running using |
I resolved these errors by building kani from the features/verify-rust-std branch, but the errors in #127 still persists.
@zhassan-aws @celinval Waiting approval to start the merge workflow. |
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.
trigger approval workflow
Towards #53
Changes
Three function contracts & four harnesses:
non_null::add
non_null::addr
non_null::align_offset
, including both positive and negative harness that triggers panic. The ensures clause foralign_offset
is referenced fromalign_offset
inlibrary/core/src/ptr/mod.rs
.Revalidation
To revalidate the verification results, run
kani verify-std -Z unstable-options "path/to/library" -Z function-contracts -Z mem-predicates --harness ptr::non_null::verify
. This will run all six harnesses in the module. All default checks should pass:❗ Warning
Running the above command with the default installed cargo kani will result in compilation error due to the latest merged from PR#91. Detailed errors are commented under that PR. This issue is waiting to be resolved.
TODO:
Layout
to create dynamically sized arrays in place of fixed size array in harnesses. This approach currently has errors and is documented in discussion.requires
clause in contract to constraincount
to be within object memory size: there is a current issue with usingub_checks::can_write
to get the object size. A workaround is implemented in the harness.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.