CBMC: Use instrumented malloc/free for MLD_ALLOC/MLD_FREE#814
Draft
hanno-becker wants to merge 3 commits intomainfrom
Draft
CBMC: Use instrumented malloc/free for MLD_ALLOC/MLD_FREE#814hanno-becker wants to merge 3 commits intomainfrom
hanno-becker wants to merge 3 commits intomainfrom
Conversation
20a9d4e to
f03a619
Compare
Contributor
mkannwischer
left a comment
There was a problem hiding this comment.
Thanks @hanno-becker. The changes itself look good to me, but CBMC fails due to timeouts. Marking as draft until we can resolve that.
f03a619 to
428a719
Compare
This commit replaces multiple successive allocations from MLD_ALLOC by a single allocation of a suitable 'workspace' structure. This reduces the number of allocations as well as the number of exit paths, thereby reducing the complexity of CBMC proofs. It also unifies the zeroization at the end of each function. Signed-off-by: Hanno Becker <beckphan@amazon.co.uk>
The default implementation of MLD_ALLOC and MLD_FREE uses stack allocation, which the compiler can assume not to fail. This means that CBMC does not exercise the cleanup paths which handle fallible dynamic allocation -- a significant proof gap. This commit changes the configuration uses for the CBMC proofs to use the (instrumented) calls to malloc/free for MLD_ALLOC/MLD_FREE. Importantly, we set --malloc-may-fail to model allocation as fallible, and --malloc-fail-null to return NULL in case of allocation failure. Signed-off-by: Hanno Becker <beckphan@amazon.co.uk>
Signed-off-by: Hanno Becker <beckphan@amazon.co.uk>
428a719 to
9ad59c8
Compare
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 default implementation of MLD_ALLOC and MLD_FREE uses stack
allocation, which the compiler can assume not to fail. This means
that CBMC does not exercise the cleanup paths which handle fallible
dynamic allocation -- a significant proof gap.
This commit changes the configuration uses for the CBMC proofs
to use the (instrumented) calls to malloc/free for MLD_ALLOC/MLD_FREE.
Importantly, we set --malloc-may-fail to model allocation as fallible,
and --malloc-fail-null to return NULL in case of allocation failure.