-
Notifications
You must be signed in to change notification settings - Fork 41
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
Draft for tool proposal (goto-transcoder) #108
Comments
Could you please describe the user-visible differences of goto-transcoder+ESBMC (to Kani, as the presently only tool in CI) that you'd know or expect? |
Could you clarify a bit? If I understood correctly you mean how a user will see the output of the tool:
|
My apologies for the unclear request. What I am seeking to understand is what advantages (and possibly also: disadvantages) we should expect when using ESBMC. Looking at the idea of integrating goto-transcoder+ESBMC with Kani (the Kani team would very much appreciate a pull request to that effect!), can you describe scenarios where ESBMC would be able to prove properties that Kani with CBMC as back-end currently cannot prove (one idea that comes to my mind is the upcoming support for quantifiers in Kani)? Are there perhaps also situations where ESBMC would not be able to prove a property? Would you expect performance differences? |
Thanks for the clarification.
Regarding performance, quantifiers could indeed be translated directly into SMT formulas. As for concrete examples, I don't have any where k-induction + SMT outperforms BMC + SAT, considering we are still in the early stages. Comparing the benchmarks where ESBMC returned a correct verdict and CBMC failed to reach a verdict (ignoring wrong results):
Now considering the cases where both ESBMC and CBMC returned the correct verdict (2207 benchmarks) in reachability:
|
Thanks @rafaelsamenezes and apologies for the delayed response. Could you please go ahead and create a (draft?) PR that integrates goto-transcoder/ESBMC into CI of this repository? Perhaps start with just one of the harnesses. |
Some updates. I have been focusing in enabling the transcoder to work with a contract, specifically: checked_unchecked_add_i8. Unchecked add i8 contractThe contract is generated by the following macro: macro_rules! generate_unchecked_math_harness {
($type:ty, $method:ident, $harness_name:ident) => {
#[kani::proof_for_contract($type::$method)]
pub fn $harness_name() {
let num1: $type = kani::any::<$type>();
let num2: $type = kani::any::<$type>();
unsafe {
num1.$method(num2);
}
}
}
}
generate_unchecked_math_harness!(i8, unchecked_add, checked_unchecked_add_i8); The property here is that unchecked_add on two nondet variables can result in an overflow, which is an UB in Rust. This is asserted in this repo by adding an ensure at the Extracting the GOTO from this repoTo start, I had to somehow obtain the GBF from the contract. So I altered the script from I expect this to be easier in the future with the merge of #170. Finding the entry-pointThe GBF file does not has a Using ESBMC to check this contractThe transcoder can already parse and convert this contract into ESBMC GBF. When executing with ESBMC we can even add the bounds-checks and pointer-checks if we want. There are some caveats, which I will go through later. For now, ESBMC generates 20 claims: Claims
Verification ConditionsUpdated:
TODOsRunning this contract in ESBMC will give the same result as CBMC, but it is still not fully implemented. There are 3 main todos right now:
Once these issues are solved, goto-transcoder should be able to fully verify this harness. Also, considering automation. I'd like to know if you have any suggestions for: automatically extract the GBF along their entry-points. |
More updates. Goto transcoder has its first release: https://github.com/rafaelsamenezes/goto-transcoder/releases/tag/v0.1 This releases allows the verification of the unchecked operators for: add, sub, mul, shr Plan for CI integration
This results in a list of GOTOs that can be used as input of the transcoder. Right now, it returns:
|
Hi @rafaelsamenezes, can you please go ahead and create a PR with the CI integration? I would also highly encourage you to add a script similar to BTW, I would also recommend passing |
+1 to what Celina said, and also I left a few comments on the ESBMC/goto-transcoder issues that are listed as "TODO" above. |
Dear team, We are opening this issue to obtain feedback on our initial proposal. The tool idea started as a discussion with
@feliperodri at ETAPS and it would be great to see it moving forward.
Tool Name
Goto-transcoder (ESBMC)
Description
The goto-transcoder is an initiative to add a compatibility layer between GOTO programs generated from CPROVER tools (e.g., CBMC and goto-instrument). Specifically, we are interested in adding support to ESBMC. The main difference between ESBMC and CBMC is that ESBMC focuses on SMT and has support for other proof strategies such as incremental bounded model checking. For this proposal, we are concentrating in the conversion between CBMC goto -> ESBMC goto so that we can improve code reuse. Therefore, we can make use of Kani to generate a GOTO program for CBMC which can then be converted into an equivalent ESBMC input.
ESBMC has a few differences to CBMC, including:
Tool Information
Yes, by converting the Kani goto program into an ESBMC-compatible one.
Yes. Similarly to CBMC, ESBMC's main use is for the verification of C programs, it has support for checking classical memory properties such as buffer overflow, dangling pointers, and memory leaks.
ESBMC is already integrated into the CI of industrial partners and it is also available in the GitHub actions marketplace for easy use. The transcoder is an independent Rust project that generates a binary that can be easily integrated into CI. We will need to work on the integration of Kani, goto-transcoder and ESBMC into a single CI job.
Both ESBMC and goto-transcoder have public development under permissive licenses, i.e., MIT and Apache 2.0.
ESBMC is a mature tool with active development, goto-transcoder is still in the initial phase (we have a list of what is currently supported).
Yes. ESBMC is a joint project of the Federal University of Amazonas (Brazil), the University of Manchester (UK), the University of Southampton (UK), and the University of Stellenbosch (South Africa).
The ESBMC development was supported by various research funding agencies, including CNPq (Brazil), CAPES (Brazil), FAPEAM (Brazil), EPSRC (UK), Royal Society (UK), British Council (UK), European Commission (Horizon 2020), and companies including ARM, Intel, Motorola Mobility, Nokia Institute of Technology and Samsung. The ESBMC development is currently funded by ARM, EPSRC grants EP/T026995/1 and EP/V000497/1, Ethereum Foundation, EU H2020 ELEGANT 957286, Intel, Motorola Mobility (through Agreement N° 4/2021), Soteria project awarded by the UK Research and Innovation for the Digital Security by Design (DSbD) Programme, and XC5 Hong Kong Limited.
Licenses
Steps to Use the Tool
For these steps let's verify a Rust hello world, we will assume that you have Kani available in your system. We will start with
the Hello World from the Kani tutorial:
Use Kani to generate the CBMC GOTO program
Invoke Kani and ask it to keep the intermediate files:
kani test.rs --keep-temps
. This generates a.out
file that is in the GBFformat. We can double-check this by invoking it with CBMC:
cbmc *test4main.out --show-goto-functions
:Convert the CBMC goto into ESBMC goto
git clone https://github.com/rafaelsamenezes/goto-transcoder.git
cargo run -- --mode 0 --input <kani-out>.out --output file-esbmc.goto
This will generate the
file-esbmc.goto
, which can be used as the ESBMC input.Invoke ESBMC
esbmc --binary file-esbmc.goto
.Artifacts
ESBMC originally came from the idea of using SMT to improve the performance of BMC tools. The original work was awarded at ASE'23 with
the Most Influential Paper award.
Awards
Links
Documentation
Selected publications
Users
CI & Versioning
ESBMC and goto-transcoder are both developed at GitHub using Git.
For CI pipelines the tools can either be invoked directly or integrated into a custom action. ESBMC already has an action.
The text was updated successfully, but these errors were encountered: