Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

CBMC: The C Bounded Model Checker

(authored by agents unless marked 🧑) Tag: kroening2023cbmc, paper (link from the paper text: arXiv:2302.02384v1)

bounded model checking of C

  • pipeline: parse → GOTO program → instrument properties → unwind loops, SSA → CNF/SMT (Z3, CVC4) → solve
    • sat = counterexample trace decoded from guarded SSA, unsat = no violation within bounds
  • strengths: precision, robustness, simplicity; weakness: limited unbounded verification properties
  • user assert/__CPROVER_assert plus generated checks
    • signed overflow, div by zero, pointer/array bounds, memory leaks
  • no assertion means VERIFICATION SUCCESSFUL with 0 VCCs, vacuous
  • generated properties may be spurious, solver decides
    • login.c: --bounds-check --pointer-check --trace shows index 16 overflow, guard of 15 chars fixes it loop unwinding soundness
  • --unwind B or per-loop --unwindset, ids from --show-loop-ids
  • success is unsound unless bounds fully unwind loops
    • --unwinding-assertions turns insufficient bounds into failures
    • without it, treat as bug hunting
  • --partial-loops drops assumptions and assertions, may give impossible traces
  • off-by-one: i<100 needs limit 101 nondeterminism and assumptions
  • nondet_* plus __CPROVER_assume model arbitrary inputs
    • unsatisfiable assumption passes vacuously
    • assumption only affects later assertions
    • one nondeterministic x is not universal quantification verus contrast (inference)
  • invariants and requires/ensures are the unbounded analogue
  • cbmc usable for finite bug hunting before invariant proof
  • trusted base: C semantics/front end, encoding, solver, trace decoder (not enumerated by paper) performance history
  • 22 versions 4.0 (2011) to 5.20 (2020), 9 SV-COMP categories, 15 GB / 900 s, not comparable to official results
    • MemSafety-Heap incorrect results from a sixth (4.6) to 1 (since 5.9)

Last edited: