© 2014 Carnegie Mellon University Synthesizing Safe Bit-Precise Invariants Arie Gurfinkel (SEI / CMU) Anton Belov (UCD / Synopsys) Joao Marques-Silva (UCD)

Slides:



Advertisements
Similar presentations
The behavior of SAT solvers in model checking applications K. L. McMillan Cadence Berkeley Labs.
Advertisements

Exploiting SAT solvers in unbounded model checking
Copyright 2000 Cadence Design Systems. Permission is granted to reproduce without modification. Introduction An overview of formal methods for hardware.
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Carnegie Mellon University Software Engineering Institute CERT® Knowledgebase Copyright © 1997 Carnegie Mellon University VU#14202 UNIX rlogin with stack.
© 2013 Carnegie Mellon University UFO: From Underapproximations to Overapproximations and Back! Arie Gurfinkel (SEI/CMU) with Aws Albarghouthi and Marsha.
Proofs from SAT Solvers Yeting Ge ACSys NYU Nov
1 1 Regression Verification for Multi-Threaded Programs Sagar Chaki, SEI-Pittsburgh Arie Gurfinkel, SEI-Pittsburgh Ofer Strichman, Technion-Haifa Originally.
© Anvesh Komuravelli Spacer Automatic Abstraction in SMT-Based Unbounded Software Model Checking Anvesh Komuravelli Carnegie Mellon University Joint work.
Aaron Bradley University of Colorado, Boulder
© 2011 Carnegie Mellon University System of Systems V&V John B. Goodenough October 19, 2011.
© 2010 Carnegie Mellon University B OXES : A Symbolic Abstract Domain of Boxes Arie Gurfinkel and Sagar Chaki Software Engineering Institute Carnegie Mellon.
© Anvesh Komuravelli IC3/PDR Overview of IC3/PDR Anvesh Komuravelli Carnegie Mellon University.
Panel on Decision Procedures Panel on Decision Procedures Randal E. Bryant Lintao Zhang Nils Klarlund Harald Ruess Sergey Berezin Rajeev Joshi.
© 2013 Carnegie Mellon University Academy for Software Engineering Education and Training, 2013 Session Architect: Tony Cowling Session Chair: Nancy Mead.
© 2013 Carnegie Mellon University Measuring Assurance Case Confidence using Baconian Probabilities Charles B. Weinstock John B. Goodenough Ari Z. Klein.
© 2012 Carnegie Mellon University UFO: Verification with Interpolants and Abstract Interpretation Arie Gurfinkel and Sagar Chaki Software Engineering Institute.
© 2015 Carnegie Mellon University Property Directed Polyhedral Abstraction Nikolaj Bjørner and Arie Gurfinkel VMCAI 2015.
SAT and Model Checking. Bounded Model Checking (BMC) A.I. Planning problems: can we reach a desired state in k steps? Verification of safety properties:
© 2013 Carnegie Mellon University Static Analysis of Real-Time Embedded Systems with REK Arie Gurfinkel 1 joint work with Sagar Chaki 1, Ofer Strichman.
© 2011 Carnegie Mellon University Binary Decision Diagrams Part Bug Catching: Automated Program Verification and Testing Sagar Chaki September.
© 2011 Carnegie Mellon University Binary Decision Diagrams Part Bug Catching: Automated Program Verification and Testing Sagar Chaki September.
Randal E. Bryant Carnegie Mellon University SRC ‘07 Word-Level Modeling and Verification of Systems Using Selective Term-Level Abstraction Sanjit A. Seshia.
Interpolants [Craig 1957] G(y,z) F(x,y)
Modeling Data in Formal Verification Bits, Bit Vectors, or Words Randal E. Bryant Carnegie Mellon University.
Bit Vector Decision Procedures A Basis for Reasoning about Hardware & Software Randal E. Bryant Carnegie Mellon University.
SAT-Based Decision Procedures for Subsets of First-Order Logic
© 2011 Carnegie Mellon University Should-Cost: A Use for Parametric Estimates Additional uses for estimation tools Presenters:Bob Ferguson (SEMA) Date:November.
© 2011 Carnegie Mellon University QUELCE: Quantifying Uncertainty in Early Lifecycle Cost Estimation Presenters:Dave Zubrow PhD Bob Ferguson (SEMA) Date:November.
Pruning techniques for the SAT-based Bounded Model-Checking problem Ofer Shtrichman Weizmann Institute of Science & IBM - HRL.
Computing Over­Approximations with Bounded Model Checking Daniel Kroening ETH Zürich.
Word Level Predicate Abstraction and Refinement for Verifying RTL Verilog Himanshu Jain Daniel Kroening Natasha Sharygina Edmund Clarke Carnegie Mellon.
Formal Verification of SpecC Programs using Predicate Abstraction Himanshu Jain Daniel Kroening Edmund Clarke Carnegie Mellon University.
Daniel Kroening and Ofer Strichman Decision Procedure
Ipek Ozkaya, COCOMO Forum © 2012 Carnegie Mellon University Affordability and the Value of Architecting Ipek Ozkaya Research, Technology.
Deciding a Combination of Theories - Decision Procedure - Changki pswlab Combination of Theories Daniel Kroening, Ofer Strichman Presented by Changki.
© 2015 Carnegie Mellon University Interpolating Property Directed Reachability Software Engineering Institute Carnegie Mellon University Pittsburgh, PA.
© 2015 Carnegie Mellon University Building Program Verifiers from Compilers and Theorem Provers Software Engineering Institute Carnegie Mellon University.
© 2013 Carnegie Mellon University Verifying Periodic Programs with Priority Inheritance Locks Sagar Chaki 1, Arie Gurfinkel 1, Ofer Strichman 2 FMCAD,
CMU, Oct 4 DPLL-based Checkers for Satisfiability Modulo Theories Cesare Tinelli Department of Computer Science The University of Iowa Joint work with.
Incremental formal verification of hardware Hana Chockler Alexander Ivrii Arie Matsliah Shiri Moran Ziv Nevo IBM Research - Haifa.
Author Software Engineering Institute
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
Nikolaj Bjørner Microsoft Research DTU Winter course January 2 nd 2012 Organized by Flemming Nielson & Hanne Riis Nielson.
© 2015 Carnegie Mellon University Parametric Symbolic Reachability Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Arie.
© 2015 Carnegie Mellon University COCOMO 2015 November 17, 2015 Distribution Statement A: Approved for Public Release; Distribution is Unlimited Causal.
© 2006 Carnegie Mellon University Introduction to CBMC: Part 1 Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Arie Gurfinkel,
1/20 Arrays Changki PSWLAB Arrays Daniel Kroening and Ofer Strichman Decision Procedure.
© Anvesh Komuravelli Spacer Compositional Verification of Procedural Programs using Horn Clauses over Integers and Arrays Anvesh Komuravelli work done.
1 A framework for eager encoding Daniel Kroening ETH, Switzerland Ofer Strichman Technion, Israel (Executive summary) (submitted to: Formal Aspects of.
© 2006 Carnegie Mellon University Introduction to CBMC: Part 1 Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Arie Gurfinkel,
© Anvesh Komuravelli Spacer Model Checking with Proofs and Counterexamples Anvesh Komuravelli Carnegie Mellon University Joint work with Arie Gurfinkel,
1 CERT BFF: From Start To PoC June 09, 2016 © 2016 Carnegie Mellon University This material has been approved for public release and unlimited distribution.
Extracting Minimum Unsatisfiable Cores with a Greedy Genetic Algorithm Jianmin Zhang, Sikun Li, and Shengyu Shen School of Computer Science, National University.
Secure Software Workforce Development Panel Session
Author Software Engineering Institute
Michael Spiegel, Esq Timothy Shimeall, Ph.D.
Interpolating Property Directed Reachability
SMT-Based Verification of Parameterized Systems
Solving Linear Arithmetic with SAT-based MC
Property Directed Reachability
Parametric Symbolic Reachability
Introduction to Software Verification
Metrics-Focused Analysis of Network Flow Data
Propositional Calculus: Boolean Algebra and Simplification
Property Directed Reachability with Word-Level Abstraction
QUELCE: Quantifying Uncertainty in Early Lifecycle Cost Estimation
Resolution Proofs for Combinational Equivalence
Verifying Periodic Programs with Priority Inheritance Locks
Verifying Clausal Proofs, DRUPing and Interpolants SAT/SMT Seminar
Presentation transcript:

© 2014 Carnegie Mellon University Synthesizing Safe Bit-Precise Invariants Arie Gurfinkel (SEI / CMU) Anton Belov (UCD / Synopsys) Joao Marques-Silva (UCD)

2 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University Copyright 2013 Carnegie Mellon University This material is based upon work funded and supported by the Department of Defense under Contract No. FA C-0003 with Carnegie Mellon University for the operation of the Software Engineering Institute, a federally funded research and development center. Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the United States Department of Defense. NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING INSTITUTE MATERIAL IS FURNISHED ON AN AS-IS BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. This material has been approved for public release and unlimited distribution. This material may be reproduced in its entirety, without modification, and freely distributed in written or electronic form without requesting formal permission. Permission is required for any other use. Requests for permission should be directed to the Software Engineering Institute at DM

3 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University 3 Inductive Invariants: Turing / Floyd / Hoare A. M. Turing, Checking a Large Routine. In Report of a Conference on High Speed Automatic Calculating Machines, (1949).

4 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University Programs, Cexs, Invariants A program P = (V, Init, Tr, Bad) P is UNSAFE if and only if there exists a number N s.t. P is SAFE if and only if there exists a safe inductive invariant Inv s.t. Inductive Safe

5 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University Many conferences, techniques, tools …

6 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University But Bit-Precise Verification is Hard Bounded Model Checking CBMC, Boolector, LLBMC, ESBMC, … efficient discovery of counter-examples no invariants! Propositional Verification (Hardware) Interpolation, IC3, PDR, ABC, … efficient synthesis of propositional invariants does not scale to bit-precise verification of software Linear Arithmetic Verification (Software) Impact, UFO, CPAChecker, Duality, Blast, GPDR, … efficient synthesis of arithmetic invariants not bit-precise (not sound!) is often sufficient (e.g., UFO at SV-COMP’13 and ‘14)

7 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University But aren’t bit-vectors = bit-blasting?

8 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University Typical Bit-vector Decision Procedure B2P is satisfiability preserving (only!) Bit-blast (by itself) is not efficient SAT Bit-blast Simplify B2P

9 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University Safety Verification by Bit-Blasting Correct, but does not scale Bit-blast Verify propositional verifier

10 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University Safety Verification by B2P Efficient, but… B2P only preserves satisfiability Original circuit is reduced (abstracted) too much Hard to track correspondence between input and output B2P Verify True

11 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University Bit-blasting looses all structure! Lack of structure makes it difficult to generalize

12 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University Our Key Idea: Use Generate and Check Alg. Given an input program P with a safety property  Bad 1. Generate a candidate invariant Cand by verifying  Bad on a “simpler” approximation P simple of P 2. Compute the Maximal Inductive Subset Inv of Cand relative to P using bit-precise reasoning 3. Strengthen Inv using a bit-precise (but possibly slow) verification engine until (Inv  Bad)

13 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University M ISPER in a Nutshell Adapt unsound arithmetic reasoning to guess bit-precise invariants Approximate Program P + Property Program P LA LA Verifier Adapt using MIS Candidate C LA BIT Verifier Invariant I BIT Yes + Certificate C BIT No + Cex Unsound Needs validation Needs validation Sound

14 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University Approximate Bit-Vectors by Arithmetic Ignore (i.e., over-approximate) all bit-vector-specific operations Unsound, but simple and efficient Approximate Bool Bit-vector Arithmetic Bool

15 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University Maximal Inductive Subset Let L be a set of formulas, P=(V, Init, Tr, Bad) a program A subset X of L is a maximal inductive subset iff it is the largest subset of X such that A Maximal Inductive Subset is unique inductive invariants are closed under conjunction Cormac Flanagan, K. Rustan M. Leino: Houdini, an Annotation Assistant for ESC/Java. FME 2001:

16 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University Minimal Unsatisfiable Subset Let  be a formula and A = {a 1, …, a n } be atomic propositions occurring negatively in  Assume  Æ a 1 Æ  Æ a n is UNSAT A minimal unsatisfiable subset (MUS) of  is the smallest subset X µ A such that  Æ X is UNSAT There are efficient algorithms for computing MUS (a.k.a. UNSAT core) for propositional formulas

17 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University Solving MIS via MUS Reduce MIS to multiple calls to MUS fresh propositional variables called once incremental SAT SAT MUS incremental SAT

18 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University Var-Equivalence Let A and B be two formulas Let X be a subset of propositional variables of A and B Definition: A and B are var-equivalent relative to X if and only if for any satisfying assignment ¿ of X, A¿ and B¿ are equisatisfiable Claim B2P(  ) is var-equivalent to  relative to X = {post i, pre i }

19 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University Implementation Misper is implemented in Python and relies on many external tools LLVM for handling C UFO-MUZ for LA invariants Boolector for B2P MUSer2 for MUS step in MIS Z3 for SMT and HORN

20 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University Results Summary 214 SAFE benchmarks from SVCOMP’2013 includes all non-trivial SAFE benchmarks All times are in seconds bit width inst.cntZ3/PDR #sol (avg/med) Misper #sol (avg/med) Cand #sol (avg/med) MIS #sol (avg/med) 32 all (127/8)174 (28/0.4)165 (8/0.4)9 (392/134) unsol (75/1)52 (22/0.7)6 (544/366) 16 all (176/8)182 (69/0.4)165 (8/0.4)17 (661/399) unsol (624/376)6 (50/21)12 (911/1,094)

21 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University Detailed Results (16 bits)

22 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University FrankenBit : Bit-Precise Verification w/ Many Bits M ISPER to synthesize bit-precise invariants LLBMC to search for counterexamples Silver and Bronze medals at SV-COMP

23 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University Related Work Cormac Flanagan, K. Rustan M. Leino: Houdini, an Annotation Assistant for ESC/Java. FME (the first?) algorithm for computing Maximal Inductive Subset Randal E. Bryant, Daniel Kroening, Joël Ouaknine, Sanjit A. Seshia, Ofer Strichman, Bryan A. Brady: Deciding Bit-Vector Arithmetic with Abstraction. TACAS sound under-approximation of bit-vector formulas by shrinking bit-width Alberto Griggio: Effective word-level interpolation for software verification. FMCAD mostly sound over-approximation of bit-vector formulas by arithmetic but, also uses unsound approximation followed by a sound check

24 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University Conclusion Sound reasoning from unsound approximations Use Linear Arithmetic to guess good invariants Use efficient bit-vector decision procedures to validate invariants Use efficient propositional Minimal Unsatisfiable Subset extractor to find Maximal Inductive Subset Use inefficient bit-precise reasoning to complete the proof Works well on SV-COMP (non bit-vector specific) benchmarks probably because the properties are mostly bit-vector agnostic e.g., API usage in Linux Device Drivers Integrated in FrankenBit:

25 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University Future Work We have just scratched the surface… CounterExample Guided Approximation-Refinement Loop block a counterexample by partial bit-blasting partially embed bit-vectors into integer arithmetic Better approximations such as in related work, e.g., Griggio, and Bryant et al. Adapt lemmas account for bit-width, overflow, and upper bound e.g., replace x > 0 with x > 0 & x <= INT_MAX Tighter integration with fixedpoint solver

26 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University

27 Synthesizing Safe Bit-Precise Invariants Gurfinkel, Belov, Marques-Silva © 2014 Carnegie Mellon University Contact Information Arie Gurfinkel Senior Researcher SEI / CMU Telephone: U.S. Mail Software Engineering Institute Customer Relations 4500 Fifth Avenue Pittsburgh, PA USA Web Customer Relations Telephone: SEI Phone: SEI Fax: