-
Notifications
You must be signed in to change notification settings - Fork 28
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
#[ensures(|result: &()| ub_checks::can_dereference(self.as_ptr() as *const u8) | ||
&& ub_checks::can_dereference(dest.as_ptr() as *const u8))] | ||
#[kani::modifies(dest.as_ptr())] |
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.
#[ensures(|result: &()| ub_checks::can_dereference(self.as_ptr() as *const u8) | |
&& ub_checks::can_dereference(dest.as_ptr() as *const u8))] | |
#[kani::modifies(dest.as_ptr())] | |
#[ensures(|result: &()| ub_checks::can_dereference(self.as_ptr() as *const u8) | |
&& ub_checks::can_dereference(dest.as_ptr() as *const u8))] | |
#[kani::modifies(dest.as_ptr())] |
#[kani::proof_for_contract(NonNull::<T>::copy_to)] | ||
pub fn non_null_check_copy_to() { | ||
// PointerGenerator instance | ||
let mut generator = PointerGenerator::<16>::new(); |
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.
How the capacity of the generator affect the running time of the proof? Can we use the maximum capacity, e.g., isize::MAX / size_of::<i32>()
here?
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?
|
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.
Resolves #53
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.