Swerve: Semester in Review. Topics  Symbolic pointer analysis  Model checking –C programs –Abstract counterexamples  Symbolic simulation and execution.

Slides:



Advertisements
Similar presentations
Model Checking Lecture 4. Outline 1 Specifications: logic vs. automata, linear vs. branching, safety vs. liveness 2 Graph algorithms for model checking.
Advertisements

Chapter 4 Computation Bjarne Stroustrup
1 Title Page Implicit and Explicit Reachable State Space Exploration Of Esterel Logical Circuits Advisor :
Part IV: Memory Management
Lecture 5.
Introduction to Formal Methods for SW and HW Development 09: SAT Based Abstraction/Refinement in Model-Checking Roberto Sebastiani Based on work and slides.
SAT Based Abstraction/Refinement in Model-Checking Based on work by E. Clarke, A. Gupta, J. Kukula, O. Strichman (CAV’02)
Context-Sensitive Interprocedural Points-to Analysis in the Presence of Function Pointers Presentation by Patrick Kaleem Justin.
Pointer Analysis – Part I Mayur Naik Intel Research, Berkeley CS294 Lecture March 17, 2009.
Analysis of programs with pointers. Simple example What are the dependences in this program? Problem: just looking at variable names will not give you.
Proofs from SAT Solvers Yeting Ge ACSys NYU Nov
CS357 Lecture: BDD basics David Dill 1. 2 BDDs (Boolean/binary decision diagrams) BDDs are a very successful representation for Boolean functions. A BDD.
Game-theoretic approach to the simulation checking problem Peter Bulychev Vladimir Zakharov Lomonosov Moscow State University.
Bebop: A Symbolic Model Checker for Boolean Programs Thomas Ball Sriram K. Rajamani
A survey of techniques for precise program slicing Komondoor V. Raghavan Indian Institute of Science, Bangalore.
INTRODUCTION TO PROGRAMMING
Parallel Inclusion-based Points-to Analysis Mario Méndez-Lojo Augustine Mathew Keshav Pingali The University of Texas at Austin (USA) 1.
Best-First Search: Agendas
Faculty of Computer Science LCPC 2007 Using ZBDDs in Points-to Analysis Stephen Curial Jose Nelson Amaral Department of Computing Science University of.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
The Ant and The Grasshopper Fast and Accurate Pointer Analysis for Millions of Lines of Code Ben Hardekopf and Calvin Lin PLDI 2007 (Best Paper & Best.
Semi-Sparse Flow-Sensitive Pointer Analysis Ben Hardekopf Calvin Lin The University of Texas at Austin POPL ’09 Simplified by Eric Villasenor.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
Pointer and Shape Analysis Seminar Context-sensitive points-to analysis: is it worth it? Article by Ondřej Lhoták & Laurie Hendren from McGill University.
Next Section: Pointer Analysis Outline: –What is pointer analysis –Intraprocedural pointer analysis –Interprocedural pointer analysis (Wilson & Lam) –Unification.
Program Design and Development
Range Analysis. Intraprocedural Points-to Analysis Want to compute may-points-to information Lattice:
Pointer Analysis for CASH Compiler Framework Deepak Garg Himanshu Jain Spring 2005.
Intraprocedural Points-to Analysis Flow functions:
Comparison Caller precisionCallee precisionCode bloat Inlining context-insensitive interproc Context sensitive interproc Specialization.
Chris Wilson and David L. Dill Computer Systems Laboratory Stanford University June, 2000 Reliable Verification Using Symbolic Simulation with Scalar Values.
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
Cloning-Based Context-Sensitive Pointer Alias Analysis using BDDs John Whaley Monica Lam Stanford University June 10, 2004.
Composing Dataflow Analyses and Transformations Sorin Lerner (University of Washington) David Grove (IBM T.J. Watson) Craig Chambers (University of Washington)
Formal Verification of SpecC Programs using Predicate Abstraction Himanshu Jain Daniel Kroening Edmund Clarke Carnegie Mellon University.
Pointer analysis. Pointer Analysis Outline: –What is pointer analysis –Intraprocedural pointer analysis –Interprocedural pointer analysis Andersen and.
Symbolic Path Simulation in Path-Sensitive Dataflow Analysis Hari Hampapuram Jason Yue Yang Manuvir Das Center for Software Excellence (CSE) Microsoft.
Topic #10: Optimization EE 456 – Compiling Techniques Prof. Carl Sable Fall 2003.
Identifying Reversible Functions From an ROBDD Adam MacDonald.
CMPS 3223 Theory of Computation Automata, Computability, & Complexity by Elaine Rich ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Slides provided.
Chapter 6 Programming Languages (2) Introduction to CS 1 st Semester, 2015 Sanghyun Park.
CS 267: Automated Verification Lecture 6: Binary Decision Diagrams Instructor: Tevfik Bultan.
Fast Points-to Analysis for Languages with Structured Types Michael Jung and Sorin A. Huss Integrated Circuits and Systems Lab. Department of Computer.
Pointer Analysis Lecture 2 G. Ramalingam Microsoft Research, India.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View BDDs.
CSC 221: Recursion. Recursion: Definition Function that solves a problem by relying on itself to compute the correct solution for a smaller version of.
Towards the better software metrics tool motivation and the first experiences Gordana Rakić Zoran Budimac.
Prolog Program Style (ch. 8) Many style issues are applicable to any program in any language. Many style issues are applicable to any program in any language.
Convergence of Model Checking & Program Analysis Philippe Giabbanelli CMPT 894 – Spring 2008.
1 Compiler Design (40-414)  Main Text Book: Compilers: Principles, Techniques & Tools, 2 nd ed., Aho, Lam, Sethi, and Ullman, 2007  Evaluation:  Midterm.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
Author: Alex Groce, Daniel Kroening, and Flavio Lerda Computer Science Department, Carnegie Mellon University Pittsburgh, PA Source: R. Alur and.
Pointer Analysis Survey. Rupesh Nasre. Aug 24, 2007.
Pointer Analysis – Part II CS Unification vs. Inclusion Earlier scalable pointer analysis was context- insensitive unification-based [Steensgaard.
Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.
Verifying Programs with BDDs Topics Representing Boolean functions with Binary Decision Diagrams Application to program verification class-bdd.ppt
CSCI1600: Embedded and Real Time Software Lecture 33: Worst Case Execution Time Steven Reiss, Fall 2015.
Chapter 5 Linked List by Before you learn Linked List 3 rd level of Data Structures Intermediate Level of Understanding for C++ Please.
© 2006 Carnegie Mellon University Introduction to CBMC: Part 1 Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Arie Gurfinkel,
LECTURE 3 Compiler Phases. COMPILER PHASES Compilation of a program proceeds through a fixed series of phases.  Each phase uses an (intermediate) form.
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
Overview of Compilation Prepared by Manuel E. Bermúdez, Ph.D. Associate Professor University of Florida Programming Language Principles Lecture 2.
© 2006 Carnegie Mellon University Introduction to CBMC: Part 1 Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Arie Gurfinkel,
Data Structures and Algorithms
CSCI1600: Embedded and Real Time Software
Binary Decision Diagrams
Coding Concepts (Basics)
Pointer analysis.
CSCI1600: Embedded and Real Time Software
Pointer analysis John Rollinson & Kaiyuan Li
Presentation transcript:

Swerve: Semester in Review

Topics  Symbolic pointer analysis  Model checking –C programs –Abstract counterexamples  Symbolic simulation and execution  Cousot: the Galois connection

Pointer Analysis (in 2001)

P.A. Terminology  Context-sensitivity: do we take calling context into account –Doing so leads to very precise but very non- polynomial algorithms  Flow-sensitivity: sensitive to control flow –Equality = unification-based = Steensgaard  Almost linear, but not very precise –Subset = inclusion-based = Anderson  Polynomial but more precise –Sensitive analyses even more expensive

P.A.: Flow-sensitivity

P.A.: Problem Formulation  Phase one: find constraints in the code –Depends on sensitivities (context, flow) –Examine stores, loads, etc.  Phase two: solve system of constraints for the complete points-to relation –Explicit: Steensgaard using union-find –Implicit: Anderson-style using BDDs

Pointer Analysis Example h 1 : v 1 = new Object(); h 2 : v 2 = new Object(); v 1.f = v 2 ; v 1.f = v 2 ; v 3 = v 1.f; v 3 = v 1.f; Input Relations vPointsTo(v 1,h 1 ) vPointsTo(v 2,h 2 ) Store(v 1,f,v 2 ) Load(v 1,f,v 3 ) Output Relations hPointsTo(h 1,f,h 2 ) vPointsTo(v 3,h 2 ) v1v1 h1h1 v2v2 h2h2 f v3v3

Zhu: Symbolic P.A.  Points-to relation can be huge, but BDDs are great at implicitly representing relations

Berndl et al: Symbolic P.A.  Subset-based formulation using BDDs  Variable ordering experiments –Sets of heap objects (“pointed to”) tend to be large and regular: putting them together at the end of the ordering helps –Interleaving the bits for sets of variables (“pointers”) helps a little –In general, important to partition the bits of the different sets in the relations

Whaley & Lam: Datalog, bddbddb  All these symbolic pointer analyses are devoting a lot of implementation time to get the BDD part correct and fast  Datalog: a declarative language for expressing (possibly recursive) relations  bddbddb: a tool to convert Datalog operations (join, project, rename, recursion) into BDD operations  Points-to analyses can now be described much more concisely in Datalog

hPointsTo(h 1, f, h 2 ) :- Store(v 1, f, v 2 ), vPointsTo(v 1, h 1 ), vPointsTo(v 2, h 2 ). v1v1 h1h1 v2v2 h2h2 f Inference Rule in Datalog v 1.f = v 2 ; Stores:

Whaley & Lam: With Context  Context sensitive analysis by cloning methods and doing a context insensitive analysis on the new call graph  Can use Datalog to express constraints necessary to determine the call graph  Cloned call graph is exponentially bigger, but clever encoding lets BDDs handle it well

CBMC: Prototype Tool ANSI-C Model VHDL /Verilog Product convert + *  = + *  = Parsing and type checking BV Logic (Tree) + *  = BV Logic Decision Problem  Equivalence reduced to bit vector logic decision problem  Tool requires decision procedure for large bit vector problems  BV problems are HUGE – directly passed to Chaff in CNF CNF Chaff

Example

Explaining Counterexamples  Counterexamples provided by model checkers are often difficult to understand and locate within the code  Previous work: find a concrete execution “close to” the counterexample by some distance metric  This work: find an abstract execution— provides more meaningful explanations

Distance Metric  Execution = (state, action) sequence –State = (control location, predicate)  Metric: compare two executions a and b –Don’t just compare a i to b i since small changes in control flow can yield “misalignment” –Distance is defined as the number of changes (in predicates and actions) to convert a to b

Symbolic Execution

Quasi-symbolic simulation  Symbolic simulation externally  scalar values internally –simulation run requires constant memory.  Key ideas –Don’t compute exact value unless necessary.  many don’t cares in large designs. –Trade time for memory.  Multiple runs to generate exact values.  Reliability of directed testing with efficiency closer to that of symbolic methods

Don’t care logic Basic Algorithm & & & & X a a X b b X c c Symbolic variable X -a X a a 0 Obeys law of excluded middle! X Conservative approximation X X X “traditional” X value 0 Don’t care variables

Decision Procedure X ? a=0 a=1 Variable selection heuristic: pick relevant variable by propagating from inputs. & & O X a a X b b X X X X b b X b b 0 ? 0 Test is Unsatisfiable!

BDDs with Approximate Values  Generic Approximate BDD apply algorithm. Approx_Apply(F,G) find top variable V compute L=left(F,G), R=right(F,G) if node(V,L,R) exists, return it else if (want_exact(V,L,R)) create node (V,L,R) return node else /* approximate */ return X

Classification Algorithm  Simulator’s classification –Care –Don’t Care  Algorithm –Initially, all variables are Don’t Care. –Simulate using sub-domain values only. –Re-classify 1 variable as Care. –Repeat until sufficient variables classified.

Review  What we’ve done: –Symbolic pointer analysis –Symbolic simulations and executions –Model checking  C programs  Abstract explanations  Where do we go from here?