Description
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.
flowchart LR
R[Rust source] --> K[Kani]
K -->|CBMC GBF| G[goto-transcoder]
G -->|ESBMC GBF| ESBMC
ESBMC has a few differences to CBMC, including:
- CBMC focuses on SAT-based encodings of unrolled programs, while ESBMC targets SMT-based encodings. The SMT support of ESBMC includes sending the full formula or using incremental-SMT.
- CBMC's concurrency support is an entirely symbolic encoding of a concurrent program in one SAT formula, while ESBMC explores each interleaving individually using context-bounded verification.
- ESBMC implements incremental-BMC and k-induction strategies.
Tool Information
- Does the tool perform Rust verification?
Yes, by converting the Kani goto program into an ESBMC-compatible one.
- Does the tool deal with unsafe Rust code?
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.
- Does the tool run independently in CI?
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.
- Is the tool open source?
Both ESBMC and goto-transcoder have public development under permissive licenses, i.e., MIT and Apache 2.0.
- Is the tool under development?
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).
- Will you or your team be able to provide support for the tool?
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
- goto-transcoder: MIT
- ESBMC: Apache License 2.0.
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:
// File: test.rs
#[kani::proof]
fn main() {
assert!(1 == 2);
}
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 GBF
format. We can double-check this by invoking it with CBMC: cbmc *test4main.out --show-goto-functions
:
[...]
main /* _RNvCshu9GRFEWjwO_4test4main */
// 12 file test.rs line 3 column 10 function main
DECL _RNvCshu9GRFEWjwO_4test4main::1::var_0 : struct tag-Unit
// 13 file /Users/runner/work/kani/kani/library/std/src/lib.rs line 44 column 9 function main
DECL _RNvCshu9GRFEWjwO_4test4main::1::var_1 : struct tag-Unit
// 14 file /Users/runner/work/kani/kani/library/std/src/lib.rs line 44 column 22 function main
DECL _RNvCshu9GRFEWjwO_4test4main::1::var_2 : c_bool[8]
[...]
Convert the CBMC goto into ESBMC goto
- Clone goto-transcoder:
git clone https://github.com/rafaelsamenezes/goto-transcoder.git
- Convert to the ESBMC file:
cargo run -- --mode 0 --input <kani-out>.out --output file-esbmc.goto
Running `target/debug/gototranscoder --mode 0 --input main.goto --output file-esbmc.goto`
[2024-10-09T13:07:20Z INFO gototranscoder] Converting CBMC input into ESBMC
[2024-10-09T13:07:20Z INFO gototranscoder] Done
This will generate the file-esbmc.goto
, which can be used as the ESBMC input.
Invoke ESBMC
- Download and install the latest version of ESBMC, at the time of this writing we used 7.7: https://github.com/esbmc/esbmc/releases/tag/v7.7
- Invoke ESBMC with the program:
esbmc --binary file-esbmc.goto
.
Solving with solver Z3 v4.13.0
Runtime decision procedure: 0.001s
Building error trace
[Counterexample]
State 1 file test.rs line 4 column 5 function main thread 0
----------------------------------------------------
Violated property:
file test.rs line 4 column 5 function main
KANI_CHECK_ID_test.cbacc14fa409fc10::test_0
0
VERIFICATION FAILED
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
- 35 awards from international competitions on software verification (SV-COMP) and testing (Test-Comp) 2012-2024 at TACAS/FASE (Strength: Bug Finding and Code Coverage).
- Most Influential Paper Award at ASE’23
- Best Tool Paper Award at SBSeg'23
- Best Paper Award at SBESC’15
- Distinguished Paper Award at ICSE’11
Links
Documentation
- https://ssvlab.github.io/esbmc/documentation.html
- https://github.com/rafaelsamenezes/goto-transcoder/blob/main/README.md
Selected publications
- Yiannis Charalambous, Norbert Tihanyi, Ridhi Jain, Youcheng Sun, Mohamed Amine Ferrag, Lucas C. Cordeiro. A New Era in Software Security: Towards Self-Healing Software via Large Language Models and Formal Verification. Technical Report, CoRR abs/2305.14752, 2023. DOI
- Rafael Menezes, Daniel Moura, Helena Cavalcante, Rosiane de Freitas, Lucas C. Cordeiro . ESBMC-Jimple: verifying Kotlin programs via jimple intermediate representation In ISSTA'22, pp. 777-780, 2022. DOI
- Franz Brauße, Fedor Shmarov, Rafael Menezes, Mikhail R. Gadelha, Konstantin Korovin, Giles Reger, Lucas C. Cordeiro. ESBMC-CHERI: towards verification of C programs for CHERI platforms with ESBMC In ISSTA'22, pp. 773-776, 2022. DOI
- Felipe R. Monteiro, Mikhail R. Gadelha, Lucas C. Cordeiro. Model checking C++ programs. In Softw. Test. Verification Reliab. 32(1), 2022. DOI, Video, Open access.
- Mikhail R. Gadelha, Lucas C. Cordeiro, Denis A. Nicole. An Efficient Floating-Point Bit-Blasting API for Verifying C Programs. In VSTTE, pp. 178-195, 2020. DOI
- Mikhail Y. R. Gadelha, Felipe R. Monteiro, Jeremy Morse, Lucas C. Cordeiro, Bernd Fischer, Denis A. Nicole. ESBMC 5.0: an industrial-strength C model checker. In ASE, pp. 888-891, 2018. DOI
- Jeremy Morse, Lucas C. Cordeiro, Denis A. Nicole, Bernd Fischer. Model checking LTL properties over ANSI-C programs with bounded traces. In Softw. Syst. Model. 14(1), pp. 65-81, 2015. DOI
- Mikhail Y. R. Gadelha, Hussama Ibrahim Ismail, Lucas C. Cordeiro. Handling loops in bounded model checking of C programs via k-induction. In Int. J. Softw. Tools Technol. Transf. 19(1), pp. 97-114, 2017. DOI
- Phillipe A. Pereira, Higo F. Albuquerque, Isabela da Silva, Hendrio Marques, Felipe R. Monteiro, Ricardo Ferreira, Lucas C. Cordeiro. SMT-based context-bounded model checking for CUDA programs. In Concur. Comput. Pract. Exp. 29(22), 2017. DOI
- Lucas C. Cordeiro, Bernd Fischer, João Marques-Silva. SMT-Based Bounded Model Checking for Embedded ANSI-C Software. In IEEE Trans. Software Eng. 38(4), pp. 957-974, 2012. DOI
- Lucas C. Cordeiro, Bernd Fischer. Verifying multi-threaded software using smt-based context-bounded model checking. In ICSE, pp. 331-340, 2011. DOI
Users
- ARM
- Ethereum Foundation
- Intel
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.