A Gentle Introduction to Program Analysis

Similar documents
Advanced Programming Methods. Introduction in program analysis

Static Analysis. Systems and Internet Infrastructure Security

Static Analysis by A. I. of Embedded Critical Software

Static Analysis: Overview, Syntactic Analysis and Abstract Interpretation TDDC90: Software Security

Lecture 6. Abstract Interpretation

Abstract Interpretation

CS 6110 S14 Lecture 38 Abstract Interpretation 30 April 2014

Flow Analysis. Data-flow analysis, Control-flow analysis, Abstract interpretation, AAM

Algebraic Program Analysis

Static Program Analysis Part 1 the TIP language

Static Analysis and Dataflow Analysis

Automatic Software Verification

The Apron Library. Bertrand Jeannet and Antoine Miné. CAV 09 conference 02/07/2009 INRIA, CNRS/ENS

CSE 403: Software Engineering, Fall courses.cs.washington.edu/courses/cse403/16au/ Static Analysis. Emina Torlak

Applications of Program analysis in Model-Based Design

Structuring an Abstract Interpreter through Value and State Abstractions: EVA, an Evolved Value Analysis for Frama C

Iterative Program Analysis Abstract Interpretation

Principles of Program Analysis. Lecture 1 Harry Xu Spring 2013

Global Optimization. Lecture Outline. Global flow analysis. Global constant propagation. Liveness analysis. Local Optimization. Global Optimization

Thursday, December 23, The attack model: Static Program Analysis

Static Program Analysis CS701

Symbolic Trajectory Evaluation - A Survey

Principles of Program Analysis: A Sampler of Approaches

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Profile-Guided Program Simplification for Effective Testing and Analysis

Simple Overflow. #include <stdio.h> int main(void){ unsigned int num = 0xffffffff;

Verifying the Safety of Security-Critical Applications

An Introduction to Heap Analysis. Pietro Ferrara. Chair of Programming Methodology ETH Zurich, Switzerland

Software Security: Vulnerability Analysis

Verification Overview Testing Theory and Principles Testing in Practice. Verification. Miaoqing Huang University of Arkansas 1 / 80

Program Static Analysis. Overview

Timing Analysis of Parallel Software Using Abstract Execution

An Approach to Behavioral Subtyping Based on Static Analysis

Sendmail crackaddr - Static Analysis strikes back

Functor abstract domain by example

Verasco: a Formally Verified C Static Analyzer

Principles of Software Construction: Objects, Design and Concurrency. Static Analysis. toad Spring 2013

Compiler Structure. Data Flow Analysis. Control-Flow Graph. Available Expressions. Data Flow Facts

Automatic Qualification of Abstract Interpretation-based Static Analysis Tools. Christian Ferdinand, Daniel Kästner AbsInt GmbH 2013

Denotational Semantics. Domain Theory

Static Analysis methods and tools An industrial study. Pär Emanuelsson Ericsson AB and LiU Prof Ulf Nilsson LiU

Critical Analysis of Computer Science Methodology: Theory

Chapter 1. Introduction

Logic-Flow Analysis of Higher-Order Programs

Simply-Typed Lambda Calculus

CS-XXX: Graduate Programming Languages. Lecture 9 Simply Typed Lambda Calculus. Dan Grossman 2012

Learning Analysis Strategies for Octagon and Context Sensitivity from Labeled Data Generated by Static Analyses

Module: Future of Secure Programming

Module: Future of Secure Programming

Chapter 1 Introduction

Proving liveness. Alexey Gotsman IMDEA Software Institute

CMPSC 497: Static Analysis

Reasoning about modules: data refinement and simulation

A New Abstraction Framework for Affine Transformers

CSE Computer Security

Introduction A Tiny Example Language Type Analysis Static Analysis 2009

Compiler Optimisation

Principles of Software Construction: Objects, Design, and Concurrency (Part 2: Designing (Sub )Systems)

3.7 Denotational Semantics

Fachgebiet Softwaretechnik, Heinz Nixdorf Institut, Universität Paderborn. 4. Testing

Welcome to Software Analysis and Testing.

Selectively Sensitive Static Analysis by Impact Pre-analysis and Machine Learning 2017 년 8 월 허기홍

Certified Memory Usage Analysis

Program Analysis and Verification

Programming Languages

CUTE: A Concolic Unit Testing Engine for C

PROGRAM ANALYSIS & SYNTHESIS

Array Dependence Analysis as Integer Constraints. Array Dependence Analysis Example. Array Dependence Analysis as Integer Constraints, cont

Software Verification : Introduction

The DOT Calculus. (Dependent Object Types) Nada Amin. June 18, Scala Days

Widening Operator. Fixpoint Approximation with Widening. A widening operator 2 L ˆ L 7``! L is such that: Correctness: - 8x; y 2 L : (y) v (x y)

Dataflow analysis (ctd.)

ait: WORST-CASE EXECUTION TIME PREDICTION BY STATIC PROGRAM ANALYSIS

Compiler Optimisation

Static Analysis. Xiangyu Zhang

Spring 2017 DD2457 Program Semantics and Analysis Lab Assignment 2: Abstract Interpretation

Hybrid Verification in SPARK 2014: Combining Formal Methods with Testing

Behavioural Equivalences and Abstraction Techniques. Natalia Sidorova

Chapter 15: Information Flow

Toward Abstract Interpretation of Program Transformations

Secure Software Development: Theory and Practice

Dataflow Analysis. Xiaokang Qiu Purdue University. October 17, 2018 ECE 468

Pierce Ch. 3, 8, 11, 15. Type Systems

Testing. ECE/CS 5780/6780: Embedded System Design. Why is testing so hard? Why do testing?

CMPSC 497: Static Analysis

Static program checking and verification

Resource Usage Analysis and its Application to Resource Certification (Part I)

Static analysis and all that

Failure-Directed Program Trimming

CSE Computer Security (Fall 2006)

CSCE 548 Building Secure Software Software Analysis Basics

Theorem proving. PVS theorem prover. Hoare style verification PVS. More on embeddings. What if. Abhik Roychoudhury CS 6214

Duet: Static Analysis for Unbounded Parallelism

Lecture Notes: Widening Operators and Collecting Semantics

Analysis/Bug-finding/Verification for Security

Runtime Checking for Program Verification Systems

Programming Languages and Compilers Qualifying Examination. Answer 4 of 6 questions.

Modular and Verified Automatic Program Repairs

Static verification of program running time

Software and Energy-aware Computing Fundamentals of static analysis of software

Transcription:

A Gentle Introduction to Program Analysis Işıl Dillig University of Texas, Austin January 21, 2014 Programming Languages Mentoring Workshop 1 / 24

What is Program Analysis? Very broad topic, but generally speaking, automated analysis of program behavior 2 / 24

What is Program Analysis? Very broad topic, but generally speaking, automated analysis of program behavior Program analysis is about developing algorithms and tools that can analyze other programs 2 / 24

What is Program Analysis? Very broad topic, but generally speaking, automated analysis of program behavior Program analysis is about developing algorithms and tools that can analyze other programs prog.c Query Program Analysis Tool 2 / 24

Applications of Program Analysis Bug finding. e.g., expose as many assertion failures as possible 3 / 24

Applications of Program Analysis Bug finding. e.g., expose as many assertion failures as possible Security. e.g., does an app leak private user data? 3 / 24

Applications of Program Analysis Bug finding. e.g., expose as many assertion failures as possible Security. e.g., does an app leak private user data? Verification. e.g., does the program always behave according to its specification? 3 / 24

Applications of Program Analysis Bug finding. e.g., expose as many assertion failures as possible Security. e.g., does an app leak private user data? Verification. e.g., does the program always behave according to its specification? Compiler optimizations. e.g., which variables should be kept in registers for fastest memory access? 3 / 24

Applications of Program Analysis Bug finding. e.g., expose as many assertion failures as possible Security. e.g., does an app leak private user data? Verification. e.g., does the program always behave according to its specification? Compiler optimizations. e.g., which variables should be kept in registers for fastest memory access? Automatic parallelization. e.g., is it safe to execute different loop iterations on parallel? 3 / 24

Dynamic vs. Static Program Analysis Two flavors of program analysis: 4 / 24

Dynamic vs. Static Program Analysis Two flavors of program analysis: Dynamic analysis: Analyzes program while it is running 4 / 24

Dynamic vs. Static Program Analysis Two flavors of program analysis: Dynamic analysis: Analyzes program while it is running Static analysis: Analyzes source code of the program 4 / 24

Dynamic vs. Static Program Analysis Two flavors of program analysis: Dynamic analysis: Analyzes program while it is running Static analysis: Analyzes source code of the program Static + reasons about all executions - less precise Dynamic + more precise - results limited to observed executions 4 / 24

Static Analysis Typical static analysis question: Given source code of program P and desired property Q, does P exhibit Q in all possible executions? 5 / 24

Static Analysis Typical static analysis question: Given source code of program P and desired property Q, does P exhibit Q in all possible executions? But this question is undecidable! 5 / 24

Static Analysis Typical static analysis question: Given source code of program P and desired property Q, does P exhibit Q in all possible executions? But this question is undecidable! This means static analyses are either: 5 / 24

Static Analysis Typical static analysis question: Given source code of program P and desired property Q, does P exhibit Q in all possible executions? But this question is undecidable! This means static analyses are either: Unsound: May say program is safe even though it is unsafe 5 / 24

Static Analysis Typical static analysis question: Given source code of program P and desired property Q, does P exhibit Q in all possible executions? But this question is undecidable! This means static analyses are either: Unsound: May say program is safe even though it is unsafe Sound, but incomplete: May say program is unsafe even though it is safe 5 / 24

Static Analysis Typical static analysis question: Given source code of program P and desired property Q, does P exhibit Q in all possible executions? But this question is undecidable! This means static analyses are either: Unsound: May say program is safe even though it is unsafe Sound, but incomplete: May say program is unsafe even though it is safe Non-terminating: Always gives correct answer when it terminates, but may run forever 5 / 24

Static Analysis Typical static analysis question: Given source code of program P and desired property Q, does P exhibit Q in all possible executions? But this question is undecidable! This means static analyses are either: Unsound: May say program is safe even though it is unsafe Sound, but incomplete: May say program is unsafe even though it is safe Non-terminating: Always gives correct answer when it terminates, but may run forever Many static analysis techniques are sound but incomplete. 5 / 24

How to design sound static analyses? Key idea: Overapproximate (i.e., abstract) program behavior 6 / 24

How to design sound static analyses? Key idea: Overapproximate (i.e., abstract) program behavior 6 / 24

How to design sound static analyses? Key idea: Overapproximate (i.e., abstract) program behavior 6 / 24

How to design sound static analyses? Key idea: Overapproximate (i.e., abstract) program behavior Bad states outside over-approximation Program safe 7 / 24

How to design sound static analyses? Key idea: Overapproximate (i.e., abstract) program behavior Bad states outside over-approximation Program safe Bad states inside over-approximation, but outside P false alarm 7 / 24

How to design sound static analyses? Key idea: Overapproximate (i.e., abstract) program behavior Bad states outside over-approximation Program safe Bad states inside over-approximation, but outside P false alarm Goal: Construct abstractions that are precise enough (i.e., few false alarms) and that scale to real programs 7 / 24

Examples of Abstractions 8 / 24

Examples of Abstractions There is no one size fits all abstraction What information is useful depends on what you want to prove about the program! 8 / 24

Examples of Abstractions There is no one size fits all abstraction What information is useful depends on what you want to prove about the program! Application No division-by-zero errors Useful abstraction zero vs. non-zero 8 / 24

Examples of Abstractions There is no one size fits all abstraction What information is useful depends on what you want to prove about the program! Application Useful abstraction No division-by-zero errors zero vs. non-zero Data structure verification list, tree, graph,... 8 / 24

Examples of Abstractions There is no one size fits all abstraction What information is useful depends on what you want to prove about the program! Application Useful abstraction No division-by-zero errors zero vs. non-zero Data structure verification list, tree, graph,... No out-of-bounds array accesses ranges of integer variables 8 / 24

How to Create Sound Abstractions? 9 / 24

How to Create Sound Abstractions? Useful theory for understanding how to design sound static analyses is abstract interpretation 9 / 24

How to Create Sound Abstractions? Useful theory for understanding how to design sound static analyses is abstract interpretation Seminal 77 paper by Patrick & Radhia Cousot 9 / 24

How to Create Sound Abstractions? Useful theory for understanding how to design sound static analyses is abstract interpretation Seminal 77 paper by Patrick & Radhia Cousot Not a specific analysis, but rather a framework for designing sound-by-construction static analyses 9 / 24

How to Create Sound Abstractions? Useful theory for understanding how to design sound static analyses is abstract interpretation Seminal 77 paper by Patrick & Radhia Cousot Not a specific analysis, but rather a framework for designing sound-by-construction static analyses Let s look at an example: A static analysis that tracks the sign of each integer variable (e.g., positive, non-negative, zero etc.) 9 / 24

First Step: Design An Abstract Domain An abstract domain is just a set of abstract values we want to track in our analysis 10 / 24

First Step: Design An Abstract Domain An abstract domain is just a set of abstract values we want to track in our analysis For our example, let s fix the following abstract domain: pos: {x x Z x > 0} zero: {0} neg: {x x Z x < 0} non-neg: {x x Z x 0} 10 / 24

First Step: Design An Abstract Domain An abstract domain is just a set of abstract values we want to track in our analysis For our example, let s fix the following abstract domain: pos: {x x Z x > 0} zero: {0} neg: {x x Z x < 0} non-neg: {x x Z x 0} In addition, every abstract domain contains: 10 / 24

First Step: Design An Abstract Domain An abstract domain is just a set of abstract values we want to track in our analysis For our example, let s fix the following abstract domain: pos: {x x Z x > 0} zero: {0} neg: {x x Z x < 0} non-neg: {x x Z x 0} In addition, every abstract domain contains: (top): Don t know, represents any value 10 / 24

First Step: Design An Abstract Domain An abstract domain is just a set of abstract values we want to track in our analysis For our example, let s fix the following abstract domain: pos: {x x Z x > 0} zero: {0} neg: {x x Z x < 0} non-neg: {x x Z x 0} In addition, every abstract domain contains: (top): Don t know, represents any value (bottom): Represents empty-set 10 / 24

Second step: Abstraction and concretization functions Abstraction function (α) maps sets of concrete elements to the most precise value in the abstract domain 11 / 24

Second step: Abstraction and concretization functions Abstraction function (α) maps sets of concrete elements to the most precise value in the abstract domain α({2, 10, 0}) = 11 / 24

Second step: Abstraction and concretization functions Abstraction function (α) maps sets of concrete elements to the most precise value in the abstract domain α({2, 10, 0}) = non-neg 11 / 24

Second step: Abstraction and concretization functions Abstraction function (α) maps sets of concrete elements to the most precise value in the abstract domain α({2, 10, 0}) = non-neg α({3, 99}) = 11 / 24

Second step: Abstraction and concretization functions Abstraction function (α) maps sets of concrete elements to the most precise value in the abstract domain α({2, 10, 0}) = non-neg α({3, 99}) = pos 11 / 24

Second step: Abstraction and concretization functions Abstraction function (α) maps sets of concrete elements to the most precise value in the abstract domain α({2, 10, 0}) = non-neg α({3, 99}) = pos α({ 3, 2}) = 11 / 24

Second step: Abstraction and concretization functions Abstraction function (α) maps sets of concrete elements to the most precise value in the abstract domain α({2, 10, 0}) = non-neg α({3, 99}) = pos α({ 3, 2}) = 11 / 24

Second step: Abstraction and concretization functions Abstraction function (α) maps sets of concrete elements to the most precise value in the abstract domain α({2, 10, 0}) = non-neg α({3, 99}) = pos α({ 3, 2}) = Concretization function (γ) maps each abstract value to sets of concrete elements 11 / 24

Second step: Abstraction and concretization functions Abstraction function (α) maps sets of concrete elements to the most precise value in the abstract domain α({2, 10, 0}) = non-neg α({3, 99}) = pos α({ 3, 2}) = Concretization function (γ) maps each abstract value to sets of concrete elements γ(pos) = {x x Z x > 0} 11 / 24

Lattices and Abstract Domains Concretization function defines partial order on abstract values: 12 / 24

Lattices and Abstract Domains Concretization function defines partial order on abstract values: A 1 A 2 iff γ(a 1 ) γ(a 2 ) 12 / 24

Lattices and Abstract Domains Concretization function defines partial order on abstract values: A 1 A 2 iff γ(a 1 ) γ(a 2 ) Furthermore, in an abstract domain, every pair of elements has a lub and glb mathematical lattice non-neg neg pos zero 12 / 24

Lattices and Abstract Domains Concretization function defines partial order on abstract values: A 1 A 2 iff γ(a 1 ) γ(a 2 ) Furthermore, in an abstract domain, every pair of elements has a lub and glb mathematical lattice non-neg neg pos zero Least upper bound of two elements is called their join useful for reasoning about control flow in programs 12 / 24

Almost-Inverses Important property of the abstraction and concretization function is that they are almost inverses: 13 / 24

Almost-Inverses Important property of the abstraction and concretization function is that they are almost inverses: A C 13 / 24

Almost-Inverses Important property of the abstraction and concretization function is that they are almost inverses: A C C' C A 13 / 24

Almost-Inverses Important property of the abstraction and concretization function is that they are almost inverses: A C C' C A This is called a Galois insertion and captures the soundness of the abstraction 13 / 24

Step 3: Abstract Semantics Given abstract domain, α, γ, need to define abstract transformers (i.e., semantics) for each statement 14 / 24

Step 3: Abstract Semantics Given abstract domain, α, γ, need to define abstract transformers (i.e., semantics) for each statement Describes how statements affect our abstraction 14 / 24

Step 3: Abstract Semantics Given abstract domain, α, γ, need to define abstract transformers (i.e., semantics) for each statement Describes how statements affect our abstraction Abstract counter-part of operational semantics rules 14 / 24

Step 3: Abstract Semantics Given abstract domain, α, γ, need to define abstract transformers (i.e., semantics) for each statement Describes how statements affect our abstraction Abstract counter-part of operational semantics rules Operational Semantics S: Var Concrete value x = y op z S': Var Concrete value 14 / 24

Step 3: Abstract Semantics Given abstract domain, α, γ, need to define abstract transformers (i.e., semantics) for each statement Describes how statements affect our abstraction Abstract counter-part of operational semantics rules Operational Semantics Abstract Semantics S: Var Concrete value A: Var Abstract value x = y op z x = y op z S': Var Concrete value A': Var Abstract value 14 / 24

Back to Our Example For our sign analysis, we can define abstract transformer for x = y + z as follows: pos neg zero non-neg pos pos pos pos neg neg neg zero pos neg zero non-neg non-neg pos non-neg non-neg 15 / 24

Back to Our Example For our sign analysis, we can define abstract transformer for x = y + z as follows: pos neg zero non-neg pos pos pos pos neg neg neg zero pos neg zero non-neg non-neg pos non-neg non-neg To ensure soundness of static analysis, must prove that abstract semantics faithfully models concrete semantics 15 / 24

Putting It All Together P Abstract domain Abstract semantics Fixed-point engine 16 / 24

Putting It All Together P Abstract domain Abstract semantics Fixed-point engine 16 / 24

Fixed-point Computations Fixed-point computation: Repeated symbolic execution of the program using abstract semantics until our approximation of the program reaches an equilibrium 17 / 24

Fixed-point Computations Fixed-point computation: Repeated symbolic execution of the program using abstract semantics until our approximation of the program reaches an equilibrium Least fixed-point: Start with underapproximation and grow the approximation until it stops growing 17 / 24

Fixed-point Computations Fixed-point computation: Repeated symbolic execution of the program using abstract semantics until our approximation of the program reaches an equilibrium Least fixed-point: Start with underapproximation and grow the approximation until it stops growing Assuming correctness of your abstract semantics, the least fixed point is an overapproximation of the program! 17 / 24

Performing Least Fixed Point Computation Represent program as a control-flow graph x =0 y =1 loop head y <= n exit block branch z =0 z!=0 x = x+1 x = x+y loop end y = y+1 18 / 24

Performing Least Fixed Point Computation Represent program as a control-flow graph Want to compute abstract values at every program point x =0 y =1 loop head y <= n exit block branch z =0 z!=0 x = x+1 x = x+y loop end y = y+1 18 / 24

Performing Least Fixed Point Computation Represent program as a control-flow graph Want to compute abstract values at every program point Initialize all abstract states to exit block x =0 y =1 loop head y <= n branch z =0 z!=0 x = x+1 x = x+y loop end y = y+1 18 / 24

Performing Least Fixed Point Computation Represent program as a control-flow graph Want to compute abstract values at every program point x =0 y =1 loop head Initialize all abstract states to Repeat until no abstract state changes at any program point: exit block y <= n branch z =0 z!=0 x = x+1 x = x+y loop end y = y+1 18 / 24

Performing Least Fixed Point Computation Represent program as a control-flow graph Want to compute abstract values at every program point x =0 y =1 loop head Initialize all abstract states to Repeat until no abstract state changes at any program point: exit block y <= n branch z =0 z!=0 Compute abstract state on entry to a basic block B by taking the join of B s predecessors x = x+1 x = x+y loop end y = y+1 18 / 24

Performing Least Fixed Point Computation Represent program as a control-flow graph Want to compute abstract values at every program point x =0 y =1 loop head Initialize all abstract states to Repeat until no abstract state changes at any program point: exit block y <= n branch z =0 z!=0 Compute abstract state on entry to a basic block B by taking the join of B s predecessors Symbolically execute each basic block using abstract semantics x = x+1 x = x+y loop end y = y+1 18 / 24

An Example x =0 y =1 x = 0; y =0; while(y <= n) { if (z == 0) { x = x+1; } else { x = x + y; } y = y+1 } loop head y <= n exit block branch z =0 z!=0 x = x+1 x = x+y loop end y = y+1 19 / 24

An Example x =0 y =1 x = 0; y =0; while(y <= n) { if (z == 0) { x = x+1; } else { x = x + y; } y = y+1 } Is x always non-negative inside the loop? loop head y <= n exit block branch z =0 z!=0 x = x+1 x = x+y loop end y = y+1 19 / 24

Fixed-Point Computation x =0 y =1 loop head y <= n exit block branch z =0 z!=0 x = x+1 x = x+y loop end y = y+1 20 / 24

Fixed-Point Computation x =0 y =1 loop head y <= n exit block branch z =0 z!=0 x = x+1 x = x+y loop end y = y+1 20 / 24

Fixed-Point Computation x = Z, y = x =0 y =1 loop head y <= n exit block branch z =0 z!=0 x = x+1 x = x+y loop end y = y+1 20 / 24

Fixed-Point Computation x = Z, y = x = Z, y = P x =0 y =1 loop head y <= n exit block branch z =0 z!=0 x = x+1 x = x+y loop end y = y+1 20 / 24

Fixed-Point Computation x = Z, y = x = Z, y = P x =0 y =1 x = Z, y = P loop head y <= n exit block branch z =0 z!=0 x = x+1 x = x+y loop end y = y+1 20 / 24

Fixed-Point Computation x = Z, y = x = Z, y = P x =0 y =1 x = Z, y = P loop head y <= n x = Z, y = P exit block branch x = Z, y = P z =0 z!=0 x = Z, y = P x = x+1 x = x+y x = Z, y = P loop end y = y+1 20 / 24

Fixed-Point Computation x = Z, y = x = Z, y = P x =0 y =1 x = Z, y = P loop head y <= n x = Z, y = P exit block branch x = Z, y = P z =0 z!=0 x = Z, y = P x = P, y = P x = x+1 x = x+y x = Z, y = P loop end y = y+1 20 / 24

Fixed-Point Computation x = Z, y = x = Z, y = P x =0 y =1 x = Z, y = P loop head y <= n x = Z, y = P exit block branch x = Z, y = P z =0 z!=0 x = Z, y = P x = P, y = P x = x+1 x = x+y x = Z, y = P x = P, y = P loop end y = y+1 20 / 24

Fixed-Point Computation x = Z, y = x = Z, y = P x =0 y =1 x = Z, y = P loop head y <= n x = Z, y = P exit block branch x = Z, y = P z =0 z!=0 x = Z, y = P x = P, y = P x = x+1 x = x+y x = Z, y = P x = P, y = P x = P, y = P loop end y = y+1 20 / 24

Fixed-Point Computation x = Z, y = x = Z, y = P x =0 y =1 x = Z, y = P loop head y <= n x = P, y = P x = Z, y = P exit block branch x = Z, y = P z =0 z!=0 x = Z, y = P x = P, y = P x = x+1 x = x+y x = Z, y = P x = P, y = P x = P, y = P x = P, y = P loop end y = y+1 20 / 24

Fixed-Point Computation x = Z, y = x = Z, y = P x =0 y =1 x = NN, y = P loop head y <= n x = P, y = P x = Z, y = P exit block branch x = Z, y = P z =0 z!=0 x = Z, y = P x = P, y = P x = x+1 x = x+y x = Z, y = P x = P, y = P x = P, y = P x = P, y = P loop end y = y+1 20 / 24

Fixed-Point Computation x = Z, y = x = Z, y = P x =0 y =1 x = NN, y = P loop head y <= n x = P, y = P x = NN, y = P exit block branch x = NN, y = P z =0 z!=0 x = NN, y = P x = P, y = P x = x+1 x = x+y x = NN, y = P x = P, y = P x = P, y = P x = P, y = P loop end y = y+1 20 / 24

Fixed-Point Computation x = Z, y = x = Z, y = P x =0 y =1 x = NN, y = P loop head y <= n x = P, y = P x = NN, y = P exit block branch x = NN, y = P z =0 z!=0 x = NN, y = P x = P, y = P x = x+1 x = x+y x = NN, y = P x = P, y = P x = P, y = P x = P, y = P loop end y = y+1 20 / 24

Fixed-Point Computation x = Z, y = x = Z, y = P x =0 y =1 x = NN, y = P loop head y <= n x = P, y = P x = NN, y = P exit block branch x = NN, y = P z =0 z!=0 x = NN, y = P x = P, y = P x = x+1 x = x+y x = NN, y = P x = P, y = P x = P, y = P x = P, y = P loop end y = y+1 20 / 24

Fixed-Point Computation x = Z, y = x = Z, y = P x =0 y =1 x = NN, y = P loop head y <= n x = P, y = P x = NN, y = P exit block branch x = NN, y = P z =0 z!=0 x = NN, y = P x = P, y = P x = x+1 x = x+y x = NN, y = P x = P, y = P x = P, y = P x = P, y = P loop end y = y+1 20 / 24

Fixed-Point Computation x = Z, y = x = Z, y = P x =0 y =1 Fixed point! x = NN, y = P loop head y <= n x = P, y = P x = NN, y = P exit block branch x = NN, y = P z =0 z!=0 x = NN, y = P x = P, y = P x = x+1 x = x+y x = NN, y = P x = P, y = P x = P, y = P x = P, y = P loop end y = y+1 20 / 24

Termination of Fixed Point Computation In this example, we quickly reached least fixed point but does this computation always terminate? 21 / 24

Termination of Fixed Point Computation In this example, we quickly reached least fixed point but does this computation always terminate? Yes, assuming abstract domain forms complete lattice 21 / 24

Termination of Fixed Point Computation In this example, we quickly reached least fixed point but does this computation always terminate? Yes, assuming abstract domain forms complete lattice This means every subset of elements (including infinite subsets) have a LUB 21 / 24

Termination of Fixed Point Computation In this example, we quickly reached least fixed point but does this computation always terminate? Yes, assuming abstract domain forms complete lattice This means every subset of elements (including infinite subsets) have a LUB Unfortunately, many interesting domains do not have this property, so we need widening operators for convergence. 21 / 24

Lessons To Take Away Considered only one static analysis approach, but illustrates two key ideas underlying program analysis: 22 / 24

Lessons To Take Away Considered only one static analysis approach, but illustrates two key ideas underlying program analysis: Abstraction: Only reason about certain properties of interest 22 / 24

Lessons To Take Away Considered only one static analysis approach, but illustrates two key ideas underlying program analysis: Abstraction: Only reason about certain properties of interest Fixed-point computation: Allows us to obtain sound overapproximation of the program 22 / 24

Lessons To Take Away Considered only one static analysis approach, but illustrates two key ideas underlying program analysis: Abstraction: Only reason about certain properties of interest Fixed-point computation: Allows us to obtain sound overapproximation of the program But many static analyses also differ in several ways: 22 / 24

Lessons To Take Away Considered only one static analysis approach, but illustrates two key ideas underlying program analysis: Abstraction: Only reason about certain properties of interest Fixed-point computation: Allows us to obtain sound overapproximation of the program But many static analyses also differ in several ways: Flow (in)sensitivity: Some analyses only compute facts for the whole program, not for every program point 22 / 24

Lessons To Take Away Considered only one static analysis approach, but illustrates two key ideas underlying program analysis: Abstraction: Only reason about certain properties of interest Fixed-point computation: Allows us to obtain sound overapproximation of the program But many static analyses also differ in several ways: Flow (in)sensitivity: Some analyses only compute facts for the whole program, not for every program point Path sensitivity: More precise analyses compute different facts for different program paths 22 / 24

Lessons To Take Away Considered only one static analysis approach, but illustrates two key ideas underlying program analysis: Abstraction: Only reason about certain properties of interest Fixed-point computation: Allows us to obtain sound overapproximation of the program But many static analyses also differ in several ways: Flow (in)sensitivity: Some analyses only compute facts for the whole program, not for every program point Path sensitivity: More precise analyses compute different facts for different program paths Analysis direction: Forwards vs. backwards 22 / 24

Challenges and Open Problems Many open problems in program analysis 23 / 24

Challenges and Open Problems Many open problems in program analysis Precise and scalable heap reasoning 23 / 24

Challenges and Open Problems Many open problems in program analysis Precise and scalable heap reasoning Concurrency 23 / 24

Challenges and Open Problems Many open problems in program analysis Precise and scalable heap reasoning Concurrency Dealing with open programs 23 / 24

Challenges and Open Problems Many open problems in program analysis Precise and scalable heap reasoning Concurrency Dealing with open programs Modular program analysis 23 / 24

Challenges and Open Problems Many open problems in program analysis Precise and scalable heap reasoning Concurrency Dealing with open programs Modular program analysis... 23 / 24

Challenges and Open Problems Many open problems in program analysis Precise and scalable heap reasoning Concurrency Dealing with open programs Modular program analysis... Exciting area with lots of interesting topics to work on! 23 / 24

Considering PhD or Postdoc? If you are interested in program analysis or verification, consider applying to UT Austin! 24 / 24