Francesco Logozzo Microsoft Research, Redmond, WA.

Slides:



Advertisements
Similar presentations
Combining Abstract Interpreters Sumit Gulwani Microsoft Research Redmond, Group Ashish Tiwari SRI RADRAD.
Advertisements

Logical Abstract Interpretation Sumit Gulwani Microsoft Research, Redmond.
Queues Printer queues Several jobs submitted to printer Jobs form a queue Jobs processed in same order as they were received.
Joint work with Mike Barnett, Robert DeLine, Manuel Fahndrich, and Wolfram Schulte Verifying invariants in object-oriented programs K. Rustan M. Leino.
Demand-driven inference of loop invariants in a theorem prover
Spec# K. Rustan M. Leino Senior Researcher Programming Languages and Methods Microsoft Research, Redmond, WA, USA Microsoft Research faculty summit, Redmond,
Challenges in increasing tool support for programming K. Rustan M. Leino Microsoft Research, Redmond, WA, USA 23 Sep 2004 ICTAC Guiyang, Guizhou, PRC joint.
Modular and Verified Automatic Program Repair Francesco Logozzo, Thomas Ball RiSE - Microsoft Research Redmond.
public int Abs(int x) { if (x < 0) return -x; else return x; } public int Abs(int x) { if (x < 0) return -x;
An Abstract Interpretation Framework for Refactoring P. Cousot, NYU, ENS, CNRS, INRIA R. Cousot, ENS, CNRS, INRIA F. Logozzo, M. Barnett, Microsoft Research.
The Spec# programming system K. Rustan M. Leino Microsoft Research, Redmond, WA, USA Distinguished Lecture Series Max Planck Institute for Software Systems.
Abstract Interpretation Part II
Approximating the Worst-Case Execution Time of Soft Real-time Applications Matteo Corti.
Continuing Abstract Interpretation We have seen: 1.How to compile abstract syntax trees into control-flow graphs 2.Lattices, as structures that describe.
Using SMT solvers for program analysis Shaz Qadeer Research in Software Engineering Microsoft Research.
Greta YorshEran YahavMartin Vechev IBM Research. { ……………… …… …………………. ……………………. ………………………… } T1() Challenge: Correct and Efficient Synchronization { ……………………………
PLDI’2005Page 1June 2005 Example (C code) int double(int x) { return 2 * x; } void test_me(int x, int y) { int z = double(x); if (z==y) { if (y == x+10)
CodeContracts & Clousot Francesco Logozzo - Microsoft Mehdi Bouaziz – ENS.
Inferring Disjunctive Postconditions Corneliu Popeea and Wei-Ngan Chin School of Computing National University of Singapore - ASIAN
Chair of Software Engineering From Program slicing to Abstract Interpretation Dr. Manuel Oriol.
© Anvesh Komuravelli Quantified Invariants in Rich Domains using Model Checking and Abstract Interpretation Anvesh Komuravelli, CMU Joint work with Ken.
Algorithm & Flow Charts Decision Making and Looping Presented By Manesh T Course:1090 CS.
K. Rustan M. Leino Research in Software Engineering (RiSE) Microsoft Research, Redmond, WA, USA Invited talk Informatics Education in Europe (IEE III’08)
Inferring Object Invariants Bor-Yuh Evan ChangK. Rustan M. Leino University of California, BerkeleyMicrosoft Research January 21, 2005 AIOOL 2005 Paris,
Our experience with the CodeContracts static checker Francesco Logozzo with M. Fahndrich, M. Barnett.
Lifting Abstract Interpreters to Quantified Logical Domains Sumit Gulwani, MSR Bill McCloskey, UCB Ashish Tiwari, SRI 1.
Assertion Checking Unified Sumit Gulwani Microsoft Research, Redmond Ashish Tiwari SRI.
Contracts, tools, verification K. Rustan M. Leino Research in Software Engineering (RiSE) Microsoft Research, Redmond Keynote, ASWEC 2010; Auckland, NZ;
Synergy: A New Algorithm for Property Checking
Houdini: An Annotation Assistant for ESC/Java Cormac Flanagan and K. Rustan M. Leino Compaq Systems Research Center.
A Numerical Abstract Domain based on Expression Abstraction + Max Operator with Application in Timing Analysis Sumit Gulwani (MSR Redmond) Bhargav Gulavani.
K. Rustan M. Leino Microsoft Research, Redmond, WA, USA with Mike Barnett, Robert DeLine, Manuel Fahndrich, and Wolfram Schulte Toward enforceable contracts.
1 Program Analysis Systematic Domain Design Mooly Sagiv Tel Aviv University Textbook: Principles.
Section 4.2 Intersections, Unions & Compound Inequalities  Using Set Diagrams and Notation  Intersections of Sets Conjunctions of Sentences and  Unions.

Patrick M. Rondon, Ming Kawaguchi, Ranjit Jhala University of California, San Diego.
ACT Class Opener: om/coord_1213_f016.htm om/coord_1213_f016.htm
Pentagons: A Weakly Relational Abstract Domain for the Efficient Validation of Array Accesses Francesco Logozzo, Manuel Fahndrich Microsoft Research, Redmond.
By: Pashootan Vaezipoor Path Invariant Simon Fraser University – Spring 09.
A Parametric Segmentation Functor for Fully Automatic and Scalable Array Content Analysis Patrick Cousot, NYU & ENS Radhia Cousot, CNRS & ENS & MSR Francesco.
Program Analysis with Dynamic Change of Precision Dirk Beyer Tom Henzinger Grégory Théoduloz Presented by: Pashootan Vaezipoor Directed Reading ASE 2008.
Program Analysis and Verification Spring 2015 Program Analysis and Verification Lecture 14: Numerical Abstractions Roman Manevich Ben-Gurion University.
Program Analysis and Verification Spring 2014 Program Analysis and Verification Lecture 14: Numerical Abstractions Roman Manevich Ben-Gurion University.
Static Program Analyses of DSP Software Systems Ramakrishnan Venkitaraman and Gopal Gupta.
Linear Inequalities and Absolute Value Inequalities.
F27SA1 Software Development 1 7. Java Programming 6 Greg Michaelson.
2.5 – Continuity A continuous function is one that can be plotted without the plot being broken. Is the graph of f(x) a continuous function on the interval.
Application to the automatic extraction of circuit shapes Charles Hymans Modular analysis of a circuit description language by Abstract Interpretation.
1.7 Linear Inequalities.  With an inequality, you are finding all values of x for which the inequality is true.  Such values are solutions and are said.
Model Checking C Programs Zijiang (James) Yang Department of Computer Science Western Michigan University In collaboration with NEC Laboratories America.
x y Example 1 x y X = 3.
1 Combining Abstract Interpreters Mooly Sagiv Tel Aviv University
CS 162 Intro to Programming II Insertion Sort 1. Assume the initial sequence a[0] a[1] … a[k] is already sorted k = 0 when the algorithm starts Insert.
Synergy: A New Algorithm for Property Checking Bhargav S. Gulavani (IIT Bombay)‏ Yamini Kannan (Microsoft Research India)‏ Thomas A. Henzinger (EPFL)‏
1 Advanced Programming Examples Output. Show the exact output produced by the following code segment. char[,] pic = new char[6,6]; for (int i = 0; i
1 Proving program termination Lecture 5 · February 4 th, 2008 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A.
1 Numeric Abstract Domains Mooly Sagiv Tel Aviv University Adapted from Antoine Mine.
4.3 Solving Systems of Linear Inequalities 11/7/12.
Chapter 2 Graphing Review. #1 Find all vertical asymptotes and holes in the graph.
A Static Analyzer for Large Safety-­Critical Software Presented by Dario Bösch, ETH Zürich Research Topics in Software Engineering Dario.
Tutorial: Proving termination and liveness
Linear Inequalities in One Variable
Spring 2016 Program Analysis and Verification
MATH Algebra II Analyzing Equations and Inequalities
Notes Over 2.1 Graph the numbers on a number line. Then write two inequalities that compare the two numbers and and 9 l l l.
1.5 Linear Inequalities.
Compound Inequalities and their Graphs
MATH CP Algebra II Analyzing Equations and Inequalities
Y x
Warm-up: State the domain.
Presentation transcript:

Francesco Logozzo Microsoft Research, Redmond, WA

A.dll B.dll Z.dll C.dll … Call Graph Construction Contract Extraction Analysis Inference Assertion Checking

Analyses Bounds, nonnull, arrays… Expression analysisHeap analysisStack analysis Source: z = x + y

MDTransform 9000 straight line instructions MDTransform

Pietro Ferrara, Francesco Logozzo and Manuel Fahndrich Safer Unsafe Code in.NET, in OOPSLA 2008

Intervals O(n) a ≤ x ≤ b No  Pentagons O(n) a≤ x ≤ b & x <y Yes Octagons O(n 3 ) ± x ± y ≤ a Yes Polyhedra O(2 n ) Σ a i x i ≤ b Yes

Domain D1 Domain D2 Domain D3

Vincent Laviron and Francesco Logozzo, Subpolyhedra: A (more) scalable approach to the inference of linear inequalities, in VMCAI 2009

assume x <= yx = 0; y = 1 assert x <= y 〈 x - y == β, β ∈ [- ∞, 0] 〉 〈 T, x ∈ [0,0] ⋀ y ∈ [1,1] 〉 〈 T, T 〉

Vincent Laviron and Francesco Logozzo, Refining Abstract Interpretation- based Static Analyses with Hints, in APLAS 2009

assume x == yx = 0; y = 1 assert x<= y 〈 x - y == 0, T 〉 〈 T, x ∈ [0,0] ⋀ y ∈ [1,1] 〉 〈 T, T 〉 〈 x - y == β, β ∈ [- 1, 0] 〉

public void Init(int N) { Contract.Requires(N > 0); int[] a = new int[N]; int i = 0; while (i < N) { a[i] = 222; i = i + 1; } Contract.Assert( ∀ k ∈ [0, N). a[k] == 222); } public void Init(int N) { Contract.Requires(N > 0); int[] a = new int[N]; int i = 0; while (i < N) { a[i] = 222; i = i + 1; } Contract.Assert( ∀ k ∈ [0, N). a[k] == 222); } If i == 0 then a not initialized a not initialized else if i > 0 a[0] == … a[i] == 222 a[0] == … a[i] == 222else impossible impossible If i == 0 then a not initialized a not initialized else if i > 0 a[0] == … a[i] == 222 a[0] == … a[i] == 222else impossible impossible Challenge 1: Effective handling of disjunction Challenge 1: Effective handling of disjunction Challenge 2: No overapproximation (can be unsound) (no hole, all the elements are initialized) Challenge 2: No overapproximation (can be unsound) (no hole, all the elements are initialized)

[222, 222] 00 i, k [0, 0] NN Segment bounds Uniform content abstraction ?? 0 i, 0 k 0 ≤ i, 0 ≤ k i == i == k i < N, k N i < N, k < N DisjunctionDisjunction

Contract.Requires(N > 0); int[] a = new int[N]; Contract.Requires(N > 0); int[] a = new int[N]; int i = 0; assume i < N a[i] = 222; assume i ≥ N j = i+1; i -> _ j -> i N -> N i -> _ j -> i N -> N 0000NN 000,i0,iNN 000,i0,iNN ,i0,iNN001,i+11,i+1?? ,i0,iNN001,i+1,j1,i+1,j?? NN001,i1,i??

000,i0,i NN NN001,i1,i?? NN ⊥ ⊥ii ?? NN001,i1,i?? 0000NN ⊥ ⊥ii?? NN00ii?? NN00ii???? Join Can be empty segments! (Disjunction)

Contract.Requires(N > 0); int[] a = new int[N]; Contract.Requires(N > 0); int[] a = new int[N]; int i = 0; assume i < N a[i] = 222; assume i ≥ N j = i+1; i -> _ j -> i N -> N i -> _ j -> i N -> N NN00ii???? NN00ii?? And so on up to a fixpoint … i, N Remove doubts (i == N && N > 0) Remove doubts (i == N && N > 0) We visited all the elements in [0, N)

〈 T, x ∈ [0,1] ⋀ y ∈ [0,+ ∞ ] 〉 〈 T, x ∈ [0,0] ⋀ y ∈ [0,+ ∞ ] 〉 assume y >= 0 ; x = 0; while x < y x++;assert x == y ; 〈 T, x ∈ [0,0] ⋀ y ∈ [0,+ ∞ ] 〉 〈 T, x ∈ [0,0] ⋀ y ∈ [1,+ ∞ ] 〉 〈 T, x ∈ [1,1] ⋀ y ∈ [1,+ ∞ ] 〉 〈 T, x ∈ [0,0] ⋀ y ∈ [0,0] 〉 〈 x – y == β’, x ∈ [0,1] ⋀ y ∈ [0,1] ⋀ β’ ∈ [0,0] 〉 〈 x – y == β, x ∈ [0,1] ⋀ y ∈ [0,1] ⋀ β ∈ [0,+ ∞ ] 〉 〈 x – y == β’, x ∈ [0,1] ⋀ y ∈ [0,+ ∞ ] ⋀ β’ ∈ [- ∞, 0] 〉