-
Notifications
You must be signed in to change notification settings - Fork 274
Feature request: Add support to Poison value #7014
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
Comments
Thanks for the request. Double^WTriple thanks for it coming with a clear minimal test case. A few questions to try to understand the need / functionality / implementation split...
I ask because implementing But, there might be some easier alternatives: A. It might be possible to make symex_decl a little bit more lazy and only create names on assignment, not declaration. This would catch potentially uninitialized things but doesn't really fit with the "assertions as checks" architecture. B. C. We could use Ali's trick of "non-deterministically save one thing to check set membership" like use after free. Does any of that make sense? Thoughts on 1--4 most appreciated. |
Just to say that I'd also view this as 1) fix/extend |
I do want to say that I understand this is a big ask and I think there are a lot of subtleties that would need to be well thought out. I just wanted to kick off the idea and I'm happy to brainstorm more on this. My use case comes from implementing Kani; hence, having a more fine grain control would be great; for example, rust doesn't allow users to read uninitialized local variables. So checking for that is a bit redundant. On the other hand, types like You are correct that allowing users to explicitly assign Here are a few open questions that I have on the semantics of these checks:
|
Take a look at Pasquale Malacaria's papers -- he has been checking properties like these with CBMC for many years. |
@celinval Am happy to discuss these either here or in a call. In my opinion checking for uninitialised variables and having poison values are rather different things. You could use the poison values to instrument in a check for uninitialised variables in a front-end like Kani but there are A. other ways of checking variable initialised and B. other uses of poison. Which is more important to you, having checks for uninitialised values or having poison values? |
That's a great question. I am leaning towards poison, which give us fine control over the analysis and it enables other use cases. That said, it would require more work on our side. What are the trade offs on the cbmc side? Any idea which one would perform better? Thanks! Btw, Sorry for the late response. |
@celinval Thanks for the thoughts and no worries about the time. Uninitialised variables : I would probably make this a two phase analysis. I'd build on the existing Poison : More complex as presumably you would want a
The best way I can think of to do this is to given an (internal, library model) implementation of
Then /for every/ read or write (or address-of, or dereference, ...) that /might/ touch a poisoned value you would then need an instrumentation pass to add an assertion:
That is going to be a lot of assertions and will add to the load on the pointer analysis. Maybe we could have a stateful, abstract interpretation pass to reduce the number of "/might/ touch" locations but I fear it will still be quite heavy. I am hoping that @tautschnig has a better idea for how to implement poison at lower cost. |
@martin-cs, coincidentally, something that may help here already exists on a branch (and will hopefully get merged soon as time allows). |
Uh oh!
There was an error while loading. Please reload this page.
As a user, I would like to be able to verify that my program only reads initialized memory. For example, I should be able to verify that the following testcase reads uninitialized memory:
CBMC's verification in the example above succeeds.
While `valgrind` is able to detect an error.
For that, it would be great if CBMC could:
poison
value.poison
to a variable in their proof harnesses.poison
.The text was updated successfully, but these errors were encountered: