-
Notifications
You must be signed in to change notification settings - Fork 31
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
Contract and harness for copy_to, copy_to_nonoverlapping, copy_from, and copy_from_nonoverlapping #149
base: main
Are you sure you want to change the base?
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.
Thanks!
…-rust-std into dhvani_mem commit to update with main
This is my contract and harness for fn copy_to,I run into these two failed checks.could you please help me understand where I am going wrong?
|
@Dhvani-Kapadia the modifies clause: #[kani::modifies(dest.as_ptr())] states that only the element that #[kani::modifies(NonNull::slice_from_raw_parts(dest, count).as_ptr()] |
The same thing applies to the ub_checks::can_dereference(NonNull::slice_from_raw_parts(self, count).as_ptr()) ub_checks::can_write(NonNull::slice_from_raw_parts(dest, count).as_ptr()) |
@zhassan-aws Thank you for the suggestion! I've applied the changes and the two failed checks for |
Thanks @zhassan-aws, @celinval and @qinheping , |
…-rust-std into dhvani_mem Chnages
Co-authored-by: Carolyn Zech <[email protected]>
Thanks @celinval , I resolved the conversations. |
Co-authored-by: Michael Tautschnig <[email protected]>
Description
This PR includes contracts and proof harnesses for the four APIs copy_to, copy_to_nonoverlapping, copy_from, and copy_from_nonoverlapping which are part of the NonNull library in Rust.
Changes Overview:
Covered APIs:
NonNull::copy_to
NonNull::copy_to_nonoverlapping
NonNull::copy_from
NonNull::opy_from_nonoverlapping
Proof harness:
non_null_check_copy_to
non_null_check_copy_to_nonoverlapping
non_null_check_copy_from
non_null_check_copy_from_nonoverlapping,
Revalidation
To revalidate the verification results, run path_to/kani/scripts/kani verify-std -Z unstable-options "path/to/library" -Z function-contracts -Z mem-predicates --harness ptr::non_null::verify. This will run all four harnesses in the module. All default checks should pass:
SUMMARY:
** 0 of 141 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 0.62114185s
Complete - 6 successfully verified harnesses, 0 failures, 6 total.
Towards issue #53
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.