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

CBMC: Understand and use the correct shape of stub-harnesses for spec-proofs #325

Closed
3 tasks done
hanno-becker opened this issue Nov 4, 2024 · 4 comments
Closed
3 tasks done
Labels
Milestone

Comments

@hanno-becker
Copy link
Contributor

hanno-becker commented Nov 4, 2024

When we verify specs, we still need to provide stub harnesses invoking the function-under-proof. Morally, it seems that those harnesses should be irrelevant, but #306 (specifically this commit a95a2ce) suggest that this may be wrong: In this commit, the spec for poly_add() does not provide any bound on the r buffer, and yet the proof goes through. This is likely because the harness allocates the data on the stack, which may inadvertently add to the pre-conditions of poly_add -- it's likely that an uninitialized poly* should have been passed.

  • Understand what the correct shape of harnesses for spec-proofs is
  • Apply needed changes throughout
  • Adjust the CBMC proof guide accordingly
@hanno-becker hanno-becker added enhancement New feature or request CBMC labels Nov 4, 2024
@hanno-becker hanno-becker added this to the cbmc-alpha milestone Nov 4, 2024
@hanno-becker
Copy link
Contributor Author

hanno-becker commented Nov 4, 2024

@rod-chapman Can you chime in? Is the suspicion correct that the harness should not pass pointers to stack allocated variables?

@rod-chapman
Copy link
Contributor

I agree that the harness should infer a little information as possible, so passing an unitialized pointer rather than a pointer to a stack-allocated local object feels OK to me, assuming the proofs all succeed. We need to confirm this advice with CBMC team, then update the Proof Guide accordingly.

@hanno-becker
Copy link
Contributor Author

The CBMC team has confirmed this.

@hanno-becker
Copy link
Contributor Author

@rod-chapman Let me know when you have updated the proof guide, and then we can close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants