-
Notifications
You must be signed in to change notification settings - Fork 277
Multi-path symex checker [blocks: 3796] #3795
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
Merged
peterschrammel
merged 25 commits into
diffblue:develop
from
peterschrammel:multi-path-symex-checker
Jan 31, 2019
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
c5beb98
Return set of updated properties
peterschrammel b843fad
Do not implicitly initialize goto checker result
peterschrammel a8413e8
Property ID should always be non-empty
peterschrammel baf79ff
Clarify comment on updated properties
peterschrammel c7966c8
Split updating properties from equation
peterschrammel 90625eb
Fix wrong include
peterschrammel d51437f
Fix documentation
peterschrammel 2fcc886
Move counterexample beautification to goto_checker
peterschrammel 0ab57df
Fix whitespace
peterschrammel dd49711
Clang-format
peterschrammel 8fcb968
Output SUCCESS and FAILURE for property status
peterschrammel adbb483
Support outputting properties into JSON streams
peterschrammel 6adaffe
Factor out output_properties_plain text
peterschrammel e2f2c31
Add goto trace storage
peterschrammel 7574896
Output property results with traces
peterschrammel 3573395
Output number of incremental goto checker iterations
peterschrammel 201ad4d
Do not output results if there are no properties
peterschrammel d7cde75
Missing line number for unwinding assertion
peterschrammel eb39229
Add all properties verifier with trace storage
peterschrammel f2fb9ab
Add multi path symex checker
peterschrammel c84f516
Use goto verifier for all-properties in CBMC
peterschrammel 7663837
Fix test matching missing property description
peterschrammel 3414d55
Multi-path checker for Java requires preprocessing
peterschrammel 093718a
Use goto verifier for all-properties in JBMC
peterschrammel 37ae8b1
Add goto-checker documentation
peterschrammel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/*******************************************************************\ | ||
|
||
Module: Goto Checker using Bounded Model Checking for Java | ||
|
||
Author: Daniel Kroening, Peter Schrammel | ||
|
||
\*******************************************************************/ | ||
|
||
/// \file | ||
/// Goto Checker using Bounded Model Checking for Java | ||
|
||
#ifndef CPROVER_JAVA_BYTECODE_JAVA_MULTI_PATH_SYMEX_CHECKER_H | ||
#define CPROVER_JAVA_BYTECODE_JAVA_MULTI_PATH_SYMEX_CHECKER_H | ||
|
||
#include <goto-checker/multi_path_symex_checker.h> | ||
|
||
#include "java_bmc_util.h" | ||
|
||
class java_multi_path_symex_checkert : public multi_path_symex_checkert | ||
{ | ||
public: | ||
java_multi_path_symex_checkert( | ||
const optionst &options, | ||
ui_message_handlert &ui_message_handler, | ||
abstract_goto_modelt &goto_model) | ||
: multi_path_symex_checkert(options, ui_message_handler, goto_model) | ||
{ | ||
java_setup_symex(options, goto_model, symex); | ||
} | ||
}; | ||
|
||
#endif // CPROVER_JAVA_BYTECODE_JAVA_MULTI_PATH_SYMEX_CHECKER_H |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ Author: Daniel Kroening, [email protected] | |
#include <ansi-c/ansi_c_language.h> | ||
|
||
#include <goto-checker/all_properties_verifier.h> | ||
#include <goto-checker/all_properties_verifier_with_trace_storage.h> | ||
|
||
#include <goto-programs/adjust_float_expressions.h> | ||
#include <goto-programs/lazy_goto_model.h> | ||
|
@@ -61,6 +62,7 @@ Author: Daniel Kroening, [email protected] | |
#include <java_bytecode/convert_java_nondet.h> | ||
#include <java_bytecode/java_bytecode_language.h> | ||
#include <java_bytecode/java_enum_static_init_unwind_handler.h> | ||
#include <java_bytecode/java_multi_path_symex_checker.h> | ||
#include <java_bytecode/java_multi_path_symex_only_checker.h> | ||
#include <java_bytecode/remove_exceptions.h> | ||
#include <java_bytecode/remove_instanceof.h> | ||
|
@@ -564,13 +566,30 @@ int jbmc_parse_optionst::doit() | |
} | ||
} | ||
|
||
// The `configure_bmc` callback passed will enable enum-unwind-static if | ||
// applicable. | ||
return bmct::do_language_agnostic_bmc( | ||
options, | ||
goto_model, | ||
ui_message_handler, | ||
configure_bmc); | ||
std::unique_ptr<goto_verifiert> verifier = nullptr; | ||
|
||
if(!options.get_bool_option("paths") && !options.is_set("cover")) | ||
{ | ||
if(!options.get_bool_option("stop-on-fail")) | ||
{ | ||
verifier = util_make_unique<all_properties_verifier_with_trace_storaget< | ||
java_multi_path_symex_checkert>>( | ||
options, ui_message_handler, goto_model); | ||
} | ||
} | ||
|
||
// fall back until everything has been ported to goto-checker | ||
if(verifier == nullptr) | ||
{ | ||
// The `configure_bmc` callback passed will enable enum-unwind-static if | ||
// applicable. | ||
return bmct::do_language_agnostic_bmc( | ||
options, goto_model, ui_message_handler, configure_bmc); | ||
} | ||
|
||
resultt result = (*verifier)(); | ||
verifier->report(); | ||
return result_to_exit_code(result); | ||
} | ||
else | ||
{ | ||
|
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,10 +25,10 @@ Author: Daniel Kroening, [email protected] | |
#include <linking/static_lifetime_init.h> | ||
|
||
#include <goto-checker/bmc_util.h> | ||
#include <goto-checker/counterexample_beautification.h> | ||
#include <goto-checker/report_util.h> | ||
#include <goto-checker/solver_factory.h> | ||
|
||
#include "counterexample_beautification.h" | ||
#include "fault_localization.h" | ||
|
||
/// Hook used by CEGIS to selectively freeze variables | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,9 @@ Author: Daniel Kroening, [email protected] | |
#include <cpp/cprover_library.h> | ||
|
||
#include <goto-checker/all_properties_verifier.h> | ||
#include <goto-checker/all_properties_verifier_with_trace_storage.h> | ||
#include <goto-checker/bmc_util.h> | ||
#include <goto-checker/multi_path_symex_checker.h> | ||
#include <goto-checker/multi_path_symex_only_checker.h> | ||
#include <goto-checker/properties.h> | ||
|
||
|
@@ -562,8 +564,28 @@ int cbmc_parse_optionst::doit() | |
} | ||
} | ||
|
||
return bmct::do_language_agnostic_bmc( | ||
options, goto_model, ui_message_handler); | ||
std::unique_ptr<goto_verifiert> verifier = nullptr; | ||
|
||
if(!options.get_bool_option("paths") && !options.is_set("cover")) | ||
{ | ||
if(!options.get_bool_option("stop-on-fail")) | ||
{ | ||
verifier = util_make_unique< | ||
all_properties_verifier_with_trace_storaget<multi_path_symex_checkert>>( | ||
options, ui_message_handler, goto_model); | ||
} | ||
} | ||
|
||
// fall back until everything has been ported to goto-checker | ||
if(verifier == nullptr) | ||
{ | ||
return bmct::do_language_agnostic_bmc( | ||
options, goto_model, ui_message_handler); | ||
} | ||
|
||
resultt result = (*verifier)(); | ||
verifier->report(); | ||
return result_to_exit_code(result); | ||
} | ||
|
||
bool cbmc_parse_optionst::set_properties() | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
\ingroup module_hidden | ||
\defgroup goto-checker goto-checker | ||
|
||
# Folder goto-checker | ||
|
||
\author Peter Schrammel | ||
|
||
The \ref goto-checker directory contains interfaces for the verification of | ||
goto-programs. | ||
|
||
There are three main concepts: | ||
* Property | ||
* Goto Verifier | ||
* Incremental Goto Checker | ||
|
||
A property has a `property_id` and identifies an assertion that is either | ||
part of the goto model or generated in the course of executing the verification | ||
algorithm. A verification algorithm determines the `status` of a property, | ||
i.e. whether the property has passed verification, failed, is yet to be | ||
analyzed, etc. See \ref property_infot. | ||
|
||
A goto verifier aims at determining and reporting | ||
the status of all or some of the properties, _independently_ of the | ||
actual verification algorithm (e.g. path-merging symbolic execution, | ||
path-wise symbolic execution, abstract interpretation). | ||
See \ref goto_verifiert. | ||
|
||
An incremental goto checker is used by a goto verifier to execute the | ||
verification algorithm. Incremental goto checkers keep the state of the | ||
analysis and can be queried by the goto verifier repeatedly to return | ||
their results incrementally. A query to an incremental goto checker | ||
either returns when a violated property has been found or the | ||
verification algorithm has terminated. If a violated property has been | ||
found then additional information (e.g. a trace) can be retrieved | ||
from the incremental goto checker (if it supports that). | ||
See \ref incremental_goto_checkert. | ||
|
||
The combination of these three concepts enables: | ||
* _Verification algorithms can be used interchangeably._ | ||
There is a single, small interface for our verification engines. | ||
* _Verification results reporting is uniform across all engines._ | ||
Downstream tools can use the reporting output without knowing | ||
which verification algorithm was at work. | ||
* _Building variants of verification engines becomes easy._ | ||
Goto verifier and incremental goto checker implementations are built from | ||
small building blocks. It should therefore be easy to build variants | ||
by implementing these interfaces instead of hooking into a monolithic engine. | ||
* _The code becomes easier to maintain._ | ||
There are N things that do one thing each rather than one thing that does | ||
N things. New variants of verification algorithms can be added and removed | ||
without impacting others. | ||
|
||
There are the following variants of goto verifiers at the moment: | ||
* \ref all_properties_verifier_with_trace_storaget : Determines the status of | ||
all properties and outputs results when the verification algorithm has | ||
terminated. A trace ends at a violated property. | ||
* \ref all_properties_verifiert : Determines the status of all properties and | ||
outputs verification results incrementally. In contrast to | ||
\ref all_properties_verifier_with_trace_storaget, | ||
\ref all_properties_verifiert does not require to store any traces. | ||
A trace ends at a violated property. | ||
|
||
There are the following variants of incremental goto checkers at the moment: | ||
* \ref multi_path_symex_checkert : The default mode of goto-symex. It explores | ||
all paths and applies aggressive path merging to generate a formula | ||
(aka 'equation') that is passed to the SAT/SMT solver. It supports | ||
determining the status of all properties, but not adding new properties | ||
after the first invocation. | ||
* \ref multi_path_symex_only_checkert : Same as \ref multi_path_symex_checkert, | ||
but does not call the SAT/SMT solver. It can only decide the status of | ||
properties by the simplifications that goto-symex performs. | ||
* There are variants for Java that perform a Java-specific preprocessing: | ||
\ref java_multi_path_symex_checkert, | ||
\ref java_multi_path_symex_only_checkert |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,19 +43,21 @@ class all_properties_verifiert : public goto_verifiert | |
incremental_goto_checkert::resultt::progresst::DONE) | ||
{ | ||
// loop until we are done | ||
++iterations; | ||
} | ||
return determine_result(properties); | ||
} | ||
|
||
void report() override | ||
{ | ||
output_properties(properties, ui_message_handler); | ||
output_properties(properties, iterations, ui_message_handler); | ||
output_overall_result(determine_result(properties), ui_message_handler); | ||
} | ||
|
||
protected: | ||
abstract_goto_modelt &goto_model; | ||
incremental_goto_checkerT incremental_goto_checker; | ||
std::size_t iterations = 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❓ Why start with 1? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because there is always at least one iteration. |
||
}; | ||
|
||
#endif // CPROVER_GOTO_CHECKER_ALL_PROPERTIES_VERIFIER_H |
Oops, something went wrong.
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.
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.
Can we have some comment here? What is multi-path in this context?