Model Checking and Its Applications

Slides:



Advertisements
Similar presentations
March 25, 2012 Organizing committee: Hana Chockler IBM Daniel Kroening Oxford Natasha Sharygina USI Leonardo Mariani Giovanni Denaro UniMiB.
Advertisements

Hybrid BDD and All-SAT Method for Model Checking Orna Grumberg Joint work with Assaf Schuster and Avi Yadgar Technion – Israel Institute of Technology.
R O O T S Field-Sensitive Points-to-Analysis Eda GÜNGÖR
Abstraction and Modular Reasoning for the Verification of Software Corina Pasareanu NASA Ames Research Center.
Data-Flow Analysis Framework Domain – What kind of solution is the analysis looking for? Ex. Variables have not yet been defined – Algorithm assigns a.
1 Regression-Verification Benny Godlin Ofer Strichman Technion.
1 1 Regression Verification for Multi-Threaded Programs Sagar Chaki, SEI-Pittsburgh Arie Gurfinkel, SEI-Pittsburgh Ofer Strichman, Technion-Haifa Originally.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 13.
A survey of techniques for precise program slicing Komondoor V. Raghavan Indian Institute of Science, Bangalore.
Linear Obfuscation to Combat Symbolic Execution Zhi Wang 1, Jiang Ming 2, Chunfu Jia 1 and Debin Gao 3 1 Nankai University 2 Pennsylvania State University.
The Software Model Checker BLAST by Dirk Beyer, Thomas A. Henzinger, Ranjit Jhala and Rupak Majumdar Presented by Yunho Kim Provable Software Lab, KAIST.
Comp 205: Comparative Programming Languages Semantics of Imperative Programming Languages denotational semantics operational semantics logical semantics.
1 Static Analysis Methods CSSE 376 Software Quality Assurance Rose-Hulman Institute of Technology March 20, 2007.
1 Regression-Verification Benny Godlin Ofer Strichman Technion.
Correctness. Until now We’ve seen how to define dataflow analyses How do we know our analyses are correct? We could reason about each individual analysis.
SAT-Based Decision Procedures for Subsets of First-Order Logic
Software Reliability Methods Sorin Lerner. Software reliability methods: issues What are the issues?
Validating High-Level Synthesis Sudipta Kundu, Sorin Lerner, Rajesh Gupta Department of Computer Science and Engineering, University of California, San.
Technion 1 Generating minimum transitivity constraints in P-time for deciding Equality Logic Ofer Strichman and Mirron Rozanov Technion, Haifa, Israel.
Synthesis of Interface Specifications for Java Classes Rajeev Alur University of Pennsylvania Joint work with P. Cerny, G. Gupta, P. Madhusudan, W. Nam,
ESP [Das et al PLDI 2002] Interface usage rules in documentation –Order of operations, data access –Resource management –Incomplete, wordy, not checked.
1 Regression Verification: Proving the equivalence of similar programs Benny Godlin Ofer Strichman Technion, Haifa, Israel (This presentation is a subset.
Data Flow Analysis Compiler Design Nov. 8, 2005.
Program Analysis Mooly Sagiv Tel Aviv University Sunday Scrieber 8 Monday Schrieber.
CS 267: Automated Verification Lecture 13: Bounded Model Checking Instructor: Tevfik Bultan.
Daniel Kroening and Ofer Strichman 1 Decision Procedures in First Order Logic Decision Procedures for Equality Logic.
Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Deciding ILPs with Branch & Bound ILP References: ‘Integer Programming’
272: Software Engineering Fall 2012 Instructor: Tevfik Bultan Lecture 4: SMT-based Bounded Model Checking of Concurrent Software.
272: Software Engineering Fall 2012 Instructor: Tevfik Bultan Lecture 17: Code Mining.
Decision Procedures An Algorithmic Point of View
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 21. Review ANALYSIS PHASE (OBJECT ORIENTED DESIGN) Functional Modeling – Use case Diagram Description.
1 Automatic Refinement and Vacuity Detection for Symbolic Trajectory Evaluation Orna Grumberg Technion Haifa, Israel Joint work with Rachel Tzoref.
Introduction Algorithms and Conventions The design and analysis of algorithms is the core subject matter of Computer Science. Given a problem, we want.
Inferring Specifications to Detect Errors in Code Mana Taghdiri Presented by: Robert Seater MIT Computer Science & AI Lab.
Type Systems CS Definitions Program analysis Discovering facts about programs. Dynamic analysis Program analysis by using program executions.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Xusheng Xiao North Carolina State University CSC 720 Project Presentation 1.
On the Relation between SAT and BDDs for Equivalence Checking Sherief Reda Rolf Drechsler Alex Orailoglu Computer Science & Engineering Dept. University.
Learning Symbolic Interfaces of Software Components Zvonimir Rakamarić.
CSCI1600: Embedded and Real Time Software Lecture 33: Worst Case Execution Time Steven Reiss, Fall 2015.
The Hashemite University Computer Engineering Department
Student: Shaobo He, Advisor: Zvonimir Rakamarić TOWARDS AUTOMATED DIFFERENTIAL PROGRAM VERIFICATION FOR APPROXIMATE COMPUTING.
Error Explanation with Distance Metrics Authors: Alex Groce, Sagar Chaki, Daniel Kroening, and Ofer Strichman International Journal on Software Tools for.
MOPS: an Infrastructure for Examining Security Properties of Software Authors Hao Chen and David Wagner Appears in ACM Conference on Computer and Communications.
On Concurrency Idioms and their Effect on Program Analysis Weizmann Institute of Science Guy Katz and David Harel.
Finding bugs with a constraint solver daniel jackson. mandana vaziri mit laboratory for computer science issta 2000.
Daniel Kroening and Ofer Strichman 1 Decision Procedures in First Order Logic Decision Procedures for Equality Logic.
STATIC CODE ANALYSIS. OUTLINE  INTRODUCTION  BACKGROUND o REGULAR EXPRESSIONS o SYNTAX TREES o CONTROL FLOW GRAPHS  TOOLS AND THEIR WORKING  ERROR.
1 Advanced course on: Parallel and Distributed Model Checking Lecture 1 – Lecturers: Orna Grumberg, Computer Science Dept, Technion Karen Yorav,
Decision Procedures in First Order Logic
Modelling and Solving Configuration Problems on Business
Presentation Title 2/4/2018 Software Verification using Predicate Abstraction and Iterative Refinement: Part Bug Catching: Automated Program Verification.
Software Testing.
Algorithms and Problem Solving
Hybrid BDD and All-SAT Method for Model Checking
SS 2017 Software Verification Bounded Model Checking, Outlook
Software Testing.
Types of Testing Visit to more Learning Resources.
CSCI1600: Embedded and Real Time Software
Program Slicing Baishakhi Ray University of Virginia
Software Testing (Lecture 11-a)
Over-Approximating Boolean Programs with Unbounded Thread Creation
All You Ever Wanted to Know About Dynamic Taint Analysis & Forward Symbolic Execution (but might have been afraid to ask) Edward J. Schwartz, Thanassis.
Reduction in End-User Shape Analysis
Algorithms and Problem Solving
CSC-682 Advanced Computer Security
Predicate Abstraction
Autonomous Network Alerting Systems and Programmable Networks
Proving Mutual Termination of single-threaded programs
CSCI1600: Embedded and Real Time Software
Presentation transcript:

Model Checking and Its Applications Orna Grumberg Technion, Israel Lecture 2 Summer School of Formal Techniques (SSFM) 2019

Outline Model checking of finite-state systems Assisting in program development Program repair Program differencing

Anna Trostanetski, Orna Grumberg, Daniel Kroening (SAS 2017) Modular Demand-Driven Analysis of Semantic Difference for Program Versions Anna Trostanetski, Orna Grumberg, Daniel Kroening (SAS 2017)

Program versions Programs often change and evolve, raising the following interesting questions: Did the new version introduce new bugs or security vulnerabilities? Did the new version remove bugs or security vulnerabilities? More generally, how does the behavior of the program change?

Differences between program versions can be exploited for: Regression testing of new version w.r.t. old version, used as “golden model” Producing zero-day attacks on old version characterizing changes in the program’s functionality

What is a difference in behavior? void p1(int& x) { if (x < 0) x = -1; return; x--; if (x >= 1) x=x+1; else while ( x ==1); x=0; } void p2(int& x) { if (x < 0) x = -1; return; x--; if (x > 2) x=x+1; else while ( x == 1); x=0; }

Full difference summary  

Full difference summary   violate Partial Equivalence

Full difference summary  

Full difference summary   violate Mutual Termination

Full difference summary  

Full difference summary   Full Equivalence

Full difference summary  

Example void p1(int& x) { if (x < 0) x = -1; return; x--;   Example void p1(int& x) { if (x < 0) x = -1; return; x--; if (x >= 1) x=x+1; else while ( x ==1); x=0; } void p2(int& x) { if (x < 0) x = -1; return; x--; if (x > 2) x=x+1; else while ( x == 1); x=0; }

Difference Summary - computation  

Difference Summary - computation Input space

Difference Summary - computation ?    

Difference Summary - computation ? Under approxi-mation  

Difference Summary - computation ? Over approximation    

main goal  

How Programs Change call graphs Changes are small, programs are big   Can our work be O(change) instead of O(program)?

Which procedures could be affected potential semantical change syntactical change

Which procedures are affected semantical change

Main ideas (1) Modular analysis applied to one pair of procedures at a time No inlining Only affected procedures are analyzed Over- and under-approximation of difference between procedures are computed

Main ideas (2) Procedures need not be fully analyzed: Unanalyzed parts are abstraction using uninterpreted functions Refinement is applied upon demand Anytime analysis: Not necessarily terminates Its partial results are meaningful The longer it runs, the more precise its results are

Program representation Program is represented by a call graph Every procedure is represented by a Control Flow Graph (CFG) We are also given a matching function between procedures in the old and new versions

A call graph is a directed graph: Nodes represent procedures It contains edge p  q if procedure p includes a call for procedure q A control flow graph (CFG) is a directed graph: Nodes represent program instructions (assignments, conditions and procedure calls) Edges represent possible flow of control

We start by characterizing a single finite path in a single procedure

example   F T  

example   F T  

Example R(x,y) = x  0  x-1  1 T(x,y) = (x-1,x) y = x+1 T x < 0 F T x := x-1 x == 1 R(x,y) = x  0  x-1  1 T(x,y) = (x-1,x)

Path characterization  

Procedure summary  

example x=0 x >= 1 x = -1 x=x+1 x < 0 F T x := x-1 x == 1  

From summary to difference summary  

example T T x < 0 x < 0 x := x-1 return -1 x := x-1 x=-1 F F

example T T x < 0 x < 0 x := x-1 return -1 x := x-1 x=-1 F F    

example T T x < 0 x < 0 x := x-1 return -1 x := x-1 x=-1 F F      

Symbolic execution Input variables are given symbolic values Every execution path is explored individually (in some heuristic order) On every branch, a feasibility check is performed with a constraint solver For procedure p the input variables are the parameters of p, denoted Vp

Computing symbolic execution  

Computing symbolic execution  

symbolic execution

computing the summaries To compute path summaries without in-lining called procedures We suggest modular symbolic execution

Modular symbolic execution  

Modular symbolic execution  

Modular symbolic execution  

Can we do better? Use abstraction for the un-analyzed (uncovered) parts Later check if these parts are needed at all for the analysis of calling procedure If needed - refine

Abstraction  

Abstract modular symbolic execution  

Refinement Since we are using uninterpreted functions, the discovered difference may not be feasible: void p1(int& x) { if (x == 5) { abs1(x); if (x==0) x = 1; } void p2(int& x) { if (x == 5) { abs2(x); if (x==0) x = -1; } abs1=abs2=abs

Refinement  

Refinement  

overall algorithm Start the analysis from the syntactically changed procedures. Analyze them with modular symbolic execution up to a certain bound Compute difference summaries for those procedures, if you can prove equivalence for all inputs – stop. Use refinement when needed Repeat for calling procedures Can be guided towards interesting procedures by the user

Experimental Results – Equivalent Benchmarks We compared to two tools that prove equivalence between procedures: Regression Verification Tool (RVT) Godlin, Benny, and Ofer Strichman. "Regression verification." Proceedings of the 46th Annual Design Automation Conference. ACM, 2009. SymDiff Lahiri, Shuvendu K., et al. "SYMDIFF: A Language-Agnostic Semantic Diff Tool for Imperative Programs." CAV. Vol. 12. 2012.

Experimental Results – Equivalent Benchmarks MDDiff MDDiffRef RVT SymDiff Const 0.545s 0.541s 4.06s 14.562s Add 0.213s 0.2s 3.85s 14.549s Sub 0.258s 0.308s 5.01s F Comp 0.841s 0.539s 5.19s LoopSub 0.847s 1.179s UnchLoop 2.838s LoopMult2 1.666s 1.689s LoopMult5 3.88s LoopMult10 9.543s LoopMult15 21.55s LoopMult20 49.031s LoopUnrch2 0.9s 0.941s LoopUnrch5 1.131s 1.126s LoopUnrch10 1.147s 1.168s LoopUnrch15 1.132s 1.191s LoopUnrch20 1.157s 1.215s

Experimental Results – Equivalent Benchmarks MDDiff MDDiffRef RVT SymDiff Const 0.545s 0.541s 4.06s 14.562s Add 0.213s 0.2s 3.85s 14.549s Sub 0.258s 0.308s 5.01s F Comp 0.841s 0.539s 5.19s LoopSub 0.847s 1.179s UnchLoop 2.838s LoopMult2 1.666s 1.689s LoopMult5 3.88s LoopMult10 9.543s LoopMult15 21.55s LoopMult20 49.031s LoopUnrch2 0.9s 0.941s LoopUnrch5 1.131s 1.126s LoopUnrch10 1.147s 1.168s LoopUnrch15 1.132s 1.191s LoopUnrch20 1.157s 1.215s

Experimental Results – Equivalent Benchmarks MDDiff MDDiffRef RVT SymDiff Const 0.545s 0.541s 4.06s 14.562s Add 0.213s 0.2s 3.85s 14.549s Sub 0.258s 0.308s 5.01s F Comp 0.841s 0.539s 5.19s LoopSub 0.847s 1.179s UnchLoop 2.838s LoopMult2 1.666s 1.689s LoopMult5 3.88s LoopMult10 9.543s LoopMult15 21.55s LoopMult20 49.031s LoopUnrch2 0.9s 0.941s LoopUnrch5 1.131s 1.126s LoopUnrch10 1.147s 1.168s LoopUnrch15 1.132s 1.191s LoopUnrch20 1.157s 1.215s

summary We have presented a difference analysis method that is: Modular (analyzes each procedure independently of its current use) Computes over- and under-approximation of inputs that produce different behavior Introduces abstraction in the form of uninterpreted functions, and allows refinement upon demand

Evolving software

Thank you