Program Analysis with Dynamic Change of Precision Dirk Beyer Tom Henzinger Grégory Théoduloz Presented by: Pashootan Vaezipoor Directed Reading ASE 2008.

Slides:



Advertisements
Similar presentations
CHECKING MEMORY SAFETY AND TEST GENERATION USING B LAST By: Pashootan Vaezipoor Computing Science Dept of Simon Fraser University.
Advertisements

An Abstract Interpretation Framework for Refactoring P. Cousot, NYU, ENS, CNRS, INRIA R. Cousot, ENS, CNRS, INRIA F. Logozzo, M. Barnett, Microsoft Research.
Shape Analysis by Graph Decomposition R. Manevich M. Sagiv Tel Aviv University G. Ramalingam MSR India J. Berdine B. Cook MSR Cambridge.
50.530: Software Engineering Sun Jun SUTD. Week 10: Invariant Generation.
Abstraction and Modular Reasoning for the Verification of Software Corina Pasareanu NASA Ames Research Center.
Pointer Analysis – Part I Mayur Naik Intel Research, Berkeley CS294 Lecture March 17, 2009.
Data-Flow Analysis Framework Domain – What kind of solution is the analysis looking for? Ex. Variables have not yet been defined – Algorithm assigns a.
3-Valued Logic Analyzer (TVP) Tal Lev-Ami and Mooly Sagiv.
CS412/413 Introduction to Compilers Radu Rugina Lecture 37: DU Chains and SSA Form 29 Apr 02.
Model-based reasoning meets code verification Michael Butler 21 May 2014 WG 2.3 Meeting 55, Orlando.
1 Symbolic Execution for Model Checking and Testing Corina Păsăreanu (Kestrel) Joint work with Sarfraz Khurshid (MIT) and Willem Visser (RIACS)
1/20 Generalized Symbolic Execution for Model Checking and Testing Charngki PSWLAB Generalized Symbolic Execution for Model Checking and Testing.
By Dirk Beyer, Alessandro Cimatti, Alberto Griggio, Erkan Keremoglu and Roberto Sebastiani Simon Fraser University (Spring 09) Presentation By: Pashootan.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 13.
Introducing BLAST Software Verification John Gallagher CS4117.
A survey of techniques for precise program slicing Komondoor V. Raghavan Indian Institute of Science, Bangalore.
BLAST-A Model Checker for C Developed by Thomas A. Henzinger (EPFL) Rupak Majumdar (UC Los Angeles) Ranjit Jhala (UC San Diego) Dirk Beyer (Simon Fraser.
The Software Model Checker BLAST by Dirk Beyer, Thomas A. Henzinger, Ranjit Jhala and Rupak Majumdar Presented by Yunho Kim Provable Software Lab, KAIST.
Liveness Counter Abstraction Liveness with Counter Abstraction A mir P nueli, J essie X u and L enore Z uck.
Termination Proofs for Systems Code Andrey Rybalchenko, EPFL/MPI joint work with Byron Cook, MSR and Andreas Podelski, MPI PLDI’2006, Ottawa.
Using Statically Computed Invariants Inside the Predicate Abstraction and Refinement Loop Himanshu Jain Franjo Ivančić Aarti Gupta Ilya Shlyakhter Chao.
Permissive Interfaces Tom Henzinger Ranjit Jhala Rupak Majumdar.
Static Analysis of Embedded C Code John Regehr University of Utah Joint work with Nathan Cooprider.
Lazy Abstraction Thomas A. Henzinger Ranjit Jhala Rupak Majumdar Grégoire Sutre UC Berkeley.
Abstractions. Outline Informal intuition Why do we need abstraction? What is an abstraction and what is not an abstraction A framework for abstractions.
Establishing Local Temporal Heap Safety Properties with Applications to Compile-Time Memory Management Ran Shaham Eran Yahav Elliot Kolodner Mooly Sagiv.
Program analysis Mooly Sagiv html://
Purity Analysis : Abstract Interpretation Formulation Ravichandhran Madhavan, G. Ramalingam, Kapil Vaswani Microsoft Research, India.
Synergy: A New Algorithm for Property Checking
Program analysis Mooly Sagiv html://
Automatically Validating Temporal Safety Properties of Interfaces Thomas Ball and Sriram K. Rajamani Software Productivity Tools, Microsoft Research Presented.
Race Checking by Context Inference Tom Henzinger Ranjit Jhala Rupak Majumdar UC Berkeley.
Software Reliability Methods Sorin Lerner. Software reliability methods: issues What are the issues?
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 18 Program Correctness To treat programming.
Describing Syntax and Semantics
Composing Dataflow Analyses and Transformations Sorin Lerner (University of Washington) David Grove (IBM T.J. Watson) Craig Chambers (University of Washington)
Lazy Abstraction Lecture 3 : Partial Analysis Ranjit Jhala UC San Diego With: Tom Henzinger, Rupak Majumdar, Ken McMillan, Gregoire Sutre.
By D. Beyer et. al. Simon Fraser University (Spring 09) Presentation By: Pashootan Vaezipoor.
Thread-modular Abstraction Refinement Thomas A. Henzinger, et al. CAV 2003 Seonggun Kim KAIST CS750b.
CSC2108 Lazy Abstraction on Software Model Checking Wai Sum Mong.
By: Pashootan Vaezipoor Path Invariant Simon Fraser University – Spring 09.
Automatic Verification of Pointer Programs using Grammar-based Shape Analysis Hongseok Yang Seoul National University (Joint Work with Oukseh Lee and Kwangkeun.
A Parametric Segmentation Functor for Fully Automatic and Scalable Array Content Analysis Patrick Cousot, NYU & ENS Radhia Cousot, CNRS & ENS & MSR Francesco.
1 Testing, Abstraction, Theorem Proving: Better Together! Greta Yorsh joint work with Thomas Ball and Mooly Sagiv.
Race Checking by Context Inference Tom Henzinger Ranjit Jhala Rupak Majumdar UC Berkeley.
Type Systems CS Definitions Program analysis Discovering facts about programs. Dynamic analysis Program analysis by using program executions.
Lazy Abstraction Jinseong Jeon ARCS, KAIST CS750b, KAIST2/26 References Lazy Abstraction –Thomas A. Henzinger et al., POPL ’02 Software verification.
Variance Analyses from Invariance Analyses Josh Berdine Microsoft Research, Cambridge Joint work with Aziem Chawdhary, Byron Cook, Dino.
Model construction and verification for dynamic programming languages Radu Iosif
Program analysis with dynamic change of precision. Philippe Giabbanelli CMPT 894 – Spring 2008.
Formal verification of skiplist algorithms Student: Trinh Cong Quy Supervisor: Bengt Jonsson Reviewer: Parosh Abdulla.
Convergence of Model Checking & Program Analysis Philippe Giabbanelli CMPT 894 – Spring 2008.
Symbolic Execution with Abstract Subsumption Checking Saswat Anand College of Computing, Georgia Institute of Technology Corina Păsăreanu QSS, NASA Ames.
Program Analysis and Verification Spring 2015 Program Analysis and Verification Lecture 12: Abstract Interpretation IV Roman Manevich Ben-Gurion University.
Predicate Abstraction. Abstract state space exploration Method: (1) start in the abstract initial state (2) use to compute reachable states (invariants)
CUTE: A Concolic Unit Testing Engine for C Koushik SenDarko MarinovGul Agha University of Illinois Urbana-Champaign.
Quantified Data Automata on Skinny Trees: an Abstract Domain for Lists Pranav Garg 1, P. Madhusudan 1 and Gennaro Parlato 2 1 University of Illinois at.
/ PSWLAB Evidence-Based Analysis and Inferring Preconditions for Bug Detection By D. Brand, M. Buss, V. C. Sreedhar published in ICSM 2007.
The software model checker BLAST Dirk Beyer, Thomas A. Henzinger, Ranjit Jhala, Rupak Majumdar Presented by Yunho Kim TexPoint fonts used in EMF. Read.
MoCHi: Software Model Checker for a Higher-Order Functional Language
Programming Languages 2nd edition Tucker and Noonan
Over-Approximating Boolean Programs with Unbounded Thread Creation
Symbolic Characterization of Heap Abstractions
Abstraction, Verification & Refinement
CUTE: A Concolic Unit Testing Engine for C
The Zoo of Software Security Techniques
BLAST: A Software Verification Tool for C programs
Programming Languages 2nd edition Tucker and Noonan
SOFTWARE ENGINEERING INSTITUTE
Presentation transcript:

Program Analysis with Dynamic Change of Precision Dirk Beyer Tom Henzinger Grégory Théoduloz Presented by: Pashootan Vaezipoor Directed Reading ASE 2008 – L’Aquila – 17 September 2008 Simon Fraser University, BC, Canada EPFL, Switzerland

Automatic Software Verification Overapproximation int main() { int a = foo(); int b = bar(a); assert(a == b); } int main() { int a = foo(); int b = bar(a); assert(a == b); } C program Verification Tool SAFE i.e. assertions cannot be violated UNSAFE Reachable states Error states General method: Create an overapproximation of the program states

Example Program We want to prove that ERR is not reachable Variables st, ok, cmd, p are tracked explicitly at first All of them except p encounter more than five values

Abstraction x = 1 y = 1 z = 2 p  { h = 3 } x = 1 y = 1 z = 2 p  { h = 3 } Concrete state x = y  z = 2 x  1, y  1, z  > p h=3 Shape graph Abstract state Predicate abstraction Explicit valuations

int f = 0, x = 1, y = 0; while (x > 0) { if (f == 0){ x = 50; f = 1; } else{ x--; y++; } } assert(y == 50); Few explicit values  Explicit domain Many values  Predicate abstraction

int f = 0, x = 1, y = 0; while (x > 0) { if (f == 0){ x = 50; f = 1; } else{ x--; y++; } } assert(y == 50); Fully Explicit Analysis f  0 x  1 y  0 f  0 x  1 y  0 f  1 x  50 y  0 f  1 x  50 y  0 f  1 x  49 y  1 f  1 x  49 y  1 f  1 x  48 y  2 f  1 x  48 y  2 f  1 x  47 y  3 f  1 x  47 y  3 … f  1 x  46 y  4 f  1 x  46 y  4 +cheap to compute -many states

Combined Analysis  Start with explicit  Precision of explicit: threshold on number of diff. values E.g. ¼ (x) = 3  Precision of predicate: set of tracked predicates E.g. ¼ = { x + y = 50, x ¸ 0, x = 0}  Switch to predicates when the explicit threshold is hit Note: Coming up with “good” predicates is an orthogonal problem int f = 0, x = 1, y = 0; while (x > 0) { if (f == 0){ x = 50; f = 1; } else{ x--; y++; } } assert(y == 50);

Combined Analysis f  0 x  1 y  0 f  0 x  1 y  0 f  1 x  50 y  0 f  1 x  50 y  0 f  1 x  49 y  1 f  1 x  49 y  1 f  1 x  48 y  2 f  1 x  48 y  2 f  1 x  48 y  2 f  1 x  48 y  2 x + y = 50 x ¸ 0 x + y = 50 x ¸ 0 f  1 x  48 y  2 f  1 x  48 y  2 x + y = 50 x = 0 x + y = 50 x = 0 Threshold hit for explicit analysis int f = 0, x = 1, y = 0; while (x > 0) { if (f == 0){ x = 50; f = 1; } else{ x--; y++; } } assert(y == 50);

Motivation  Flexible combination of abstract domains  Dynamically update their respective precisions  precision: set of predicates, variables, etc. to track  e.g. switch on/off analyses  e.g. use different analyses for different variables  …

Configurable Program Analysis [Beyer/Henzinger/T 2007] Reached, Frontier := { e 0 } while Frontier   do remove e from Frontier for each e’  post( e ) do for each e’’  Reached do e’’ new := merge( e’, e’’ ) if e’’ new  e’’ then replace e’’ in Reached, Frontier by e’’ new if  stop(e’, Reached ) add e’ to Reached, Frontier return Reached

Configurable Program Analysis -Better combination of abstractions  Configurable Program Analysis [CAV07] Unified framework that enables intermediate algorithms Imprecise Scalable Precise Expensive Data-flow analysis Model Checking CPA

Configurable Program Analysis [Beyer/Henzinger/T 2007] Reached, Frontier := { e 0 } while Frontier   do remove e from Frontier for each e’  post( e ) do for each e’’  Reached do e’’ new := merge( e’, e’’ ) if e’’ new  e’’ then replace e’’ in Reached, Frontier by e’’ new if  stop(e’, Reached ) add e’ to Reached, Frontier return Reached

Configurable Program Analysis with Dynamic Precision Adjustment Reached, Frontier := { ( e 0, π 0 ) } while Frontier   do remove ( e, π ) from Frontier ( ê, π new ) = prec( e, π, Reached )‏ for each e’  post( ê, π new ) do for each ( e’’, π’’ )  Reached do e’’ new := merge( e’, e’’, π new ) if e’’ new  e’’ then replace ( e’’, π’’ ) in Reached, Frontier by (e’’ new, π new ) if  stop(e’, Reached, π new ) add (e’, π new ) to Reached, Frontier return Reached (CPA+)‏

CPA+ Configurable program analysis with dynamic precision adjustment: - concrete system (C, c 0, ! ) - abstract domain (E, >, ?, v, t ) - a set of precisions ¦ - concretization function  : E ! 2 C - transfer function post µ E £ ¦  2 E - merge operator merge: E £ E £ ¦ ! E - termination check stop: E £ 2 E £ ¦ ! B - precision adjustment: prec: E £ ¦ £ 2 E £ ¦  E £ ¦ Note: Operators are required to be soundly overapproximating e e’ 1 e’ 2 … ¼ post e.e’ merge(e,e’, ¼ )‏ e1e1 e2e2 … R = e3e3 e stop(e,R, ¼ ) = true e ¼ ¼’ prec Reached e’

CPA+ Configurable program analysis with dynamic precision adjustment: - concrete system (C, c 0, ! ) - abstract domain (E, >, ?, v, t ) - a set of precisions ¦ - concretization function  : E ! 2 C - transfer function post µ E £ ¦  2 E - merge operator merge: E £ E £ ¦ ! Emerge sep (e,e’, ¼ ) = e’ merge join (e,e’, ¼ ) = e t e’ - termination check stop: E £ 2 E £ ¦ ! B stop sep (e,R, ¼ )= 9 e’ 2 R, e v e’ stop join (e,R, ¼ ) = e v t R - precision adjustment: prec: E £ ¦ £ 2 E £ ¦  E £ ¦ Note: Operators are required to be soundly overapproximating

Composite CPA+ E 1 £ E 2, ¦ 1 £ ¦ 2 post £, merge £, stop £, prec £ Composite CPA+ E 1 £ E 2, ¦ 1 £ ¦ 2 post £, merge £, stop £, prec £ Composite CPA+ D 1 E 1, ¦ 1 post 1, merge 1, stop 1, prec 1 D 1 E 1, ¦ 1 post 1, merge 1, stop 1, prec 1 D 2 E 2, ¦ 2 post 2, merge 2, stop 2, prec 2 D 2 E 2, ¦ 2 post 2, merge 2, stop 2, prec 2 Composite operators: Strengthening operators " 1, " 2

Composite CPA+ Example: Predicate Abstraction + Explicit Example of composite abstract element: ( 6,x > 0 Æ x = y,{ i  2, x  >, y  > })‏ L (locations)‏ P (predicate abstraction)‏ C (explicit analysis)‏

Domain and Precisions Abstract domainPrecisions / Precision Adjustment Predicate Abstraction E = 2 P ¦ = 2 P e.g. e = { x 0 } prec P (e, ¼,R) = (e, ¼ )‏ Explicit Analysis E = [ X  Z ] Z = Z [ { ?, > } ¦ = [ X  N ] e.g. e = { x  2, y  >, … } Set of tracked predicates Max. number of diff. values per variable CPA+ P C prec C (e, ¼,R) = (e’, ¼ )‏ if for all x 2 X: if |R(x)| ¸ ¼ (x), then e’(x) = > otherwise, e’(x) = e(x)‏

Example: Predicate Abstraction + Explicit Idea: Dynamically choose between explicit & predicate abstraction - Too many explicit values  predicate abstraction - Use explicit values to infer predicates Implementable in the composite prec operator Note: explicit analysis ¼ testing on some variables

Example: Predicate Abstraction + Explicit Composite precision adjustment: prec((l, P, v), ( ¼ L, ¼ P, ¼ C ), R) = ((l,P’,v’), ( ¼ L, ¼ ’ P, ¼ ’ C ))‏ if (v’, ¼’ C ) = prec C (v, ¼ C, {(v’’, ¼’’ C ) | ((l,P,v’’), ( ¢, ¢, ¼’’ C )) 2 R})‏ and ¼ ’ P = ¼ P [  x 2 X: v(x)  >Æ v’(x)= > abstract(x, {v’’|((l,P,v’’), ¢ ) 2 R}) P’= P [ { p 2 ( ¼ ’ P n ¼ P ) | v ² p }

Program Threshold Pred. only k = 0 Predicate + Explicit k = 1 k = 5 Explicit only k = 1 ex10.46 s0.17 s0.21 s― ex20.43 s0.16 s0.21 s1.00 s loop s26.01 s22.78 s0.16 s loop s s s0.44 s square―――0.08 s Precision for explicit analysis: ¼ C (x) = k Program Threshold Pred. only k = 0 Predicate + Explicit k = 1 k = 2 s3_clnt (total)‏75.11 s10.40 s18.42 s s3_srvr (total)‏ s24.23 s34.40 s

Another combination: Shapes + Explicit heap Composite CPA+ Idea:Switch to shape analysis triggered by then number of nodes in the explicit heap. Composite CPA+ Idea:Switch to shape analysis triggered by then number of nodes in the explicit heap. L (locations)‏ S (shape analysis)‏ H (explicit heap analysis)‏

Conclusion  Framework to express change of precision during the analysis (  refinement)‏  Useful when composing existing analyses  Make combination more effective/precise  Ongoing/Future work  Improve predicate inference from explicit values  Integration with refinement loop  Use explicit heap to infer good predicates for shape analysis (e.g. instrumentation predicates)‏