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

Redo Heapster Lifetime Subsumption #1410

Merged
merged 24 commits into from
Aug 9, 2021
Merged

Conversation

eddywestbrook
Copy link
Contributor

A key aspect of lifetimes is the ability to have one lifetime contain in another, i.e., to have the bigger lifetime subsume the smaller one. Previously, the way this was modeled in Heapster was to put the lowned permissions of the bigger lifetime l1 inside the lowned permissions of the smaller lifetime l2, i.e., to represent subsumption by having a permission like

l2 : lowned (ps_in2 -o ps_out2, l1:lowned (ps_in1 -o ps_out1))

The idea is that l1 subsuming l2 means you can't end l1 until after you end l2. Unfortunately, this gets gross, because you have implications inside implications. Further, it means you can't have a bigger lifetime subsume multiple smaller lifetimes, which is actually useful and possibly necessary in a lot of case for, e.g., Rust code.

Luckily, I recently worked out the semantics of a lifetime ownership permission of the form

l1 : lowned [ls] (ps_in1 -o ps_out1)

where ls is a list of lifetimes that are subsumed inside of l1. Lifetime l1 cannot be ended unless ls is empty, but a subsumed lifetime in ls can be removed from the lowned permission of l1 once it has finished. To indicate that a lifetime in ls has finished, we also include a new permission construct

l2 : lfinished

along with an implication rule that allows a lifetime in the ls of an ownership permission to be removed if it has finished.

This approach solves the above problems, because lowned permissions no longer contain other lowned permissions and because lifetimes can now contain more than one subsumed lifetime. Further, it makes lifetime permissions more compositional, allowing the implication prover to deal with different lifetimes separately.

Note that this PR is based on #1406, and so should wait for that PR to be merged before it is merged.

Eddy Westbrook added 22 commits July 28, 2021 12:27
…pending on its type; also removed old PPInfo-related code
…ion of contained lifetimes, along with an lfinished permission
…on before eliminating it and would then go right back to trying to eliminate that same permission again...
…lock permission; changed proveVarLLVMBlocks to focus first on eliminating memblock permissions on the left that overlap with but are not contained in memblock permissions on the right
…s a tagged union type where we already know from something on the left what the tag is, in which case we can avoid searching for proofs of all the disjuncts other than the one that matches that known tag
…ence shape sh;emptysh with the empty shape when necessary
…y two separate functions, all of which now take lists of multi-bindings instead of multi-bindings of lists
…fied lowned permission, along with all the new and modified rules; also removed a bunch of whitespace from a previous commit
@eddywestbrook eddywestbrook added the subsystem: heapster Issues specifically related to memory verification using Heapster label Aug 6, 2021
@eddywestbrook eddywestbrook requested review from glguy and m-yac August 6, 2021 21:35
Copy link
Member

@glguy glguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the algorithm well enough to have a useful opinion about how sound the implementation is, so I can't weigh in on that. (I don't think that's what you're looking for from me, either).

From a code perspective things seem good other than the parser comment I made above.

This code seems to have a copy of the previous PR included which makes me worry that it's out of sync with master. (and which made doing the review a bit trickier)

heapster-saw/src/Verifier/SAW/Heapster/Parser.y Outdated Show resolved Hide resolved
@eddywestbrook eddywestbrook requested a review from glguy August 9, 2021 13:16
@eddywestbrook eddywestbrook merged commit 6f49ec1 into master Aug 9, 2021
@mergify mergify bot deleted the heapster-lifetime-subsumption branch August 9, 2021 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
subsystem: heapster Issues specifically related to memory verification using Heapster
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants