-
Notifications
You must be signed in to change notification settings - Fork 48
Contract & Harnesses for byte_sub, offset, map_addr and with_addr #107
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 & Harnesses for byte_sub, offset, map_addr and with_addr #107
Conversation
Also, re your PR description: it seems like the issue you mention for #91 was resolved by building Kani from source. Can you update your PR description if that is the case? Please also add "Towards #ISSUE-NUMBER" with the appropriate issue link for your challenge. |
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.
Please make sure to remove all other edits that are not in non_null.rs
.
I wanted to use can_dereference for |
@Dhvani-Kapadia I suspect this is another import error--you should be importing |
…rify-rust-std into dhvani_develop added count=0 for offset
@carolynzech , @zhassan-aws , @feliperodri could you please review it. |
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.
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 review
Improve the logging in our PR approvals workflow. This is a good thing to do generally, but we're specifically trying to debug why the script is failing in #107. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses. Co-authored-by: Michael Tautschnig <[email protected]>
The `check_approvals` workflow in #107 fails because by default Github [only returns the first 30 results](https://docs.github.com/en/rest/using-the-rest-api/using-pagination-in-the-rest-api?apiVersion=2022-11-28#about-pagination) for GET requests to their API. #107 has more review activity than that, so the approvals are all on the second or third pages, hence why the workflow says zero approvals. So, this PR updates the script to fetch 100 responses per page, up to 100 pages. These are arbitrary values, but I didn't want to have any infinite loops, and I can't imagine a realistic PR ever going above these numbers (and I put a warning in the script if they do). I checked that this new workflow runs without error [on my fork](https://github.com/carolynzech/verify-rust-std/actions/runs/12267930897/job/34228889979?pr=20). I also did some experimentation in my local bash with the branch from #107 and verified that upping the pagination limits like this does indeed return the approvals on the later pages. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
Description
This PR includes contracts and proof harnesses for the four APIs,
offset
,byte_sub
,map_addr
, andwith_addr
which are part of the NonNull library in Rust.Changes Overview:
Covered APIs:
NonNull::offset: Adds an offset to a pointer
NonNull::byte_sub: Calculates an offset from a pointer in bytes.
NonNull:: map_addr: Creates a new pointer by mapping self's address to a new one
NonNull::with_addr: Creates a new pointer with the given address
Proof harness:
non_null_check_offset
non_null_check_byte_sub
non_null_check_map_addr
non_null_check_with_addr
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 four harnesses in the module. All default checks should pass:
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.