Skip to content
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

aead: Support stacked borrows model using a new InOut type. #2164

Merged
merged 1 commit into from
Dec 7, 2024

Conversation

briansmith
Copy link
Owner

Notably, InOut::input_output_len constructs the input pointer from the output pointer in a way that safely avoids any concerns about the order of borrowing the (now implicit) input slice and output slice, and in particular whether any such borrowing invalidates any pointers derived from those slices.

Practically, this helps people who are using Miri in its default stacked borrows mode (as opposed to the tree borrows mode) verify the memory safety of our code.

@briansmith briansmith self-assigned this Dec 5, 2024
@briansmith
Copy link
Owner Author

@jasonyu1996 PTAL at this, to see if it completely addresses your concern.

Copy link

codecov bot commented Dec 5, 2024

Codecov Report

Attention: Patch coverage is 89.23077% with 7 lines in your changes missing coverage. Please review.

Project coverage is 96.91%. Comparing base (224bd7d) to head (50fd56a).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/aead/inout.rs 77.41% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2164      +/-   ##
==========================================
- Coverage   96.94%   96.91%   -0.03%     
==========================================
  Files         151      152       +1     
  Lines       20043    20064      +21     
  Branches      467      467              
==========================================
+ Hits        19430    19446      +16     
- Misses        505      512       +7     
+ Partials      108      106       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Notably, `InOut::input_output_len` constructs the `input` pointer
from the `output` pointer in a way that safely avoids any concerns
about the order of borrowing the (now implicit) input slice and
output slice, and in particular whether any such borrowing
invalidates any pointers derived from those slices.

Practically, this helps people who are using Miri in its default
stacked borrows mode (as opposed to the tree borrows mode)
verify the memory safety of our code.
@jasonyu1996
Copy link

@jasonyu1996 PTAL at this, to see if it completely addresses your concern.

The change looks good to me.

@briansmith briansmith merged commit cb6d5de into main Dec 7, 2024
156 of 158 checks passed
@briansmith briansmith deleted the b/inout-1 branch December 7, 2024 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants