-
Notifications
You must be signed in to change notification settings - Fork 277
generate assert(false) when calling undefined function #8292
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
Conversation
ef8bc33
to
020649b
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #8292 +/- ##
===========================================
- Coverage 78.40% 78.38% -0.02%
===========================================
Files 1722 1722
Lines 188252 188267 +15
Branches 18497 18487 -10
===========================================
- Hits 147593 147572 -21
- Misses 40659 40695 +36 ☔ View full report in Codecov by Sentry. |
020649b
to
038854d
Compare
8846400
to
64074af
Compare
The idea of getting rid of quiet-ish potential unsoundness is good but for a long time we have been telling people that Also should this change other tools? Could we make the semantics consistent across tools and analyses by simply adding a pass that calls |
That keeps working (and hasn't emitted a warning before, the prefix |
Worth considering! This may be somewhat specific to the tool, depending on how function pointers are handled. |
1d8d9fd
to
c2c896f
Compare
bb69a46
to
2e71950
Compare
Can I suggest documenting how to do this, say in Note that the body of the function is not defined. The name of the function itself is irrelevant (save for the prefix), but must be unique. Also note that a nondeterministic choice is not to be confused with a probabilistic (or random) choice.
+ You can also cause existing function calls in your program to return a nondeterministic value by using `goto-instrument --generate-havocing-body`.
+ This is particularly useful for functions that do not have an implementation available.
+ By default, such functions are modelled as having a body of `assert(false)`, and CBMC prints a "`no body for callee`" warning.
+ This means that verification will fail on code that calls these functions.
+ Generating a havocing body for functions whose body has not been linked in ensures that you can verify code that calls these functions.
|
I think it belongs into a section about modular reasoning. |
if(cmdline.isset("havoc-undefined-functions")) | ||
options.set_option("havoc-undefined-functions", true); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also needs to be removed from the man
page.
This changes the symbolic execution engine to emit an assert(false) when processing a call to a function without body, instead of merely emitting a warning. The key benefit is that undefined function bodies are a threat to soundness, especially when CBMC is run without a human operator (say in CI) who might spot the warning. A common scenario is a call to a function that was renamed, or whose signature has changed. This scenario now triggers a verification failure. Users who prefer the previous, or other alternative behaviors, can achieve this via program instrumentation, say using goto-instrument.
2e71950
to
6c99724
Compare
This changes the symbolic execution engine to emit an
assert(false)
when processing a call to a function without body, instead of merely emitting a warning.The key benefit is that undefined function bodies are a threat to soundness, especially when CBMC is run without a human operator (say in CI) who might spot the warning. A common scenario is a call to a function that was renamed, or whose signature has changed. This scenario now triggers a verification failure.
Users who prefer the previous, or other alternative behaviors, can achieve this via program instrumentation, say using
goto-instrument
.