Repository navigation
Give a loop no unchecked half over a local whose block has closed - #3709
Merged
Merged
Conversation
At -O2 a loop over a named object is split where __rucc_extent says the object ends, and the half before that runs with no check in it. room() answered from the capability's bounds alone, so a loop writing through a pointer to a buffer whose block had closed ran unchecked, and the liveness check the build with every check makes never ran. room() now answers zero for a local whose frame returned or whose block closed, so the whole loop runs checked and its first access is refused.
49 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The "what the elimination took out" job has failed on main for a while with one problem:
a-pointer-to-a-block-scope-local-followed-in-another-file-after-the-blockgives no report at-O2and exits 0. It is refused at-O0and-O1. Buildingmainat-O2andfollowat-O0is still refused, and the other way round is not, so the miss is in the-O2build offollow.That loop is split in two at
-O2.__rucc_extentsays how many bytes the object has from the pointer on, the loop runs that far with no check in it, and the rest runs with every check. For a named object (a local or a global) the answer comes fromroom, which looks at the capability's bounds and nothing else. The half with no check has no liveness check either, so a write through a pointer to a buffer whose block had closed ran unchecked, and the__rucc_check_livethat refuses it at-O0is only in the other half.roomnow gives zero for a local whose frame returned or whose block closed, by the same witnessliveasks. The whole loop then runs checked, and its first access is refused as J1. A capability that is not named still goes to the planes as before, and a freed heap block was never a question forroom.The runtime test for a returned frame now also checks that
roomgives the full sixteen bytes before the frame closes and zero after.Checked on the Linux box:
cargo test -p rucc-safe-rt(422 tests) passes and clippy with-D warningsis clean.cargo xtask accountinggives 208 programs compared with 0 divergences and 0 problems, where main has the one above.cargo xtask safetygives 116 refused and 90 silent, the same as main.