Top Banner
SMT for Cryptographic & Concurrent Software Verification (Part I) Chao Wang ECE Dept., Virginia Tech SAT/SMT Summer School, Semmering, Austria, July 10-12, 2014
104

SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Apr 23, 2018

Download

Documents

dangliem
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

SMT for Cryptographic & Concurrent

Software Verification

(Part I)

Chao Wang

ECE Dept., Virginia Tech

SAT/SMT Summer School, Semmering, Austria, July 10-12, 2014

Page 2: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

My Background

• Performance• Reliability• Security

VLSI Circuits

Concurrent Software- Multi-core, multi-threaded - Concurrency- Symbolic predictive analysis

Embedded Software- C/C++ programs- Numerical analysis - Abstract interpretation

- Finite state machine- Boolean analysis - Model checking

Cryptographic Software- Security and Privacy- Power side channel - SMT based analysis

Univ. Colorado, Boulder

2000-2004

NEC Labs, Princeton

2004-2011

Virginia Tech, Blacksburg

2011-present

Page 3: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Today’s Talk

• Performance• Reliability• Security

Embedded Software- C/C++ program- Numerical analysis - Abstract interpretation

Concurrent Software- Multi-core, multi-threaded - Concurrency- Symbolic predictive analysis

Cryptographic Software- Security and Privacy- Power side channel - SMT based analysis

VLSI Circuits

- Finite state machine- Boolean analysis - Model checking

Univ. Colorado, Boulder

2000-2004

NEC Labs, Princeton

2004-2011

Virginia Tech, Blacksburg

2011-present

Page 4: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Today’s Talk

• Performance• Reliability• Security

Embedded Software- C/C++ program- Numerical analysis - Abstract interpretation

Concurrent Software- Multi-core, multi-threaded - Concurrency- Symbolic predictive analysis

Cryptographic Software- Security and Privacy- Power side channel - SMT based analysis

VLSI Circuits

- Finite state machine- Boolean analysis - Model checking

Univ. Colorado, Boulder

2000-2004

NEC Labs, Princeton

2004-2011

Virginia Tech, Blacksburg

2011-present

Page 5: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Concurrency: Why?

• “Moore says Moore’s Law to hit wall.” CNET News 1997

– “If current trends in microprocessors were to continue, by 2010 they’d burn as hot as the surface of the sun.” Intel engineers 1999

• Can’t make it go faster? Stuff more CPU cores!

Page 6: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Everyone’s Happy

Tilera (2007)

Page 7: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Everyone’s Happy… except programmers

Apps

Programming Models & LanguagesCompilers/Auto-Tuners/ToolsRuntime Systems

Processors

Program Analysis

Page 8: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Outline

• Embedded Systems: Why?

• Concurrent Software: Why?

• Symbolic Predictive Analysis

– Part I: Monitoring

– Part II: Predicting

• Future Research Vision

Page 9: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Thread

Main

Multithreaded C/C++ Program

Thread 1

Thread

2

Thread

3

Challenging Problem (in industry today)

Test Input

POSIX Threads Library

(Pthreads)

Rest of the Linux OS

Your expectation: If the program fails the given

test, you want to see the bug

Reality:Even if the program may fail,

you perhaps won’t see it

Why? Thread scheduling is

controlled by the OS and the

Pthreads library

Page 10: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Thread

Main

Multithreaded C/C++ Program

Thread 1

Thread

2

Thread

3

The Monitoring Approach

Test Input

POSIX Threads Library

(Pthreads)

Rest of the Linux OS

We control scheduling!

We repeatedly run the program till all possible scenarios are covered

Thread scheduler &

dynamic model checker

Tools like this:

VeriSoft, CHESS, Inspect, …

Page 11: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Monitoring & Control

Thread #1…

s1: ask_master (“I’m #1, can I go?”);

tmpx = data1;

s2: ask_master (“I’m #1, can I go?”);

data2 = tmpx+1;

Thread #2…

s3: ask_master (“I’m #2, can I go?”);

tmpy = data2;

s4: ask_master (“I’m #2, can I go?”);

data1 = tmpy-1;

Instrumentation(source code injection)

Thread #1…

s1: tmpx = data1;

s2: data2 = tmpx+1;

Thread #2…

s3: tmpy = data2;

s4: data1 = tmpy-1;

Page 12: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Serializing an execution (interleaving)

data1= data2 = 0

Interleaving 1:

Thr#1: s1

Thr#1: s2

Thr#2: s3

Thr#2: s4

data1 = 0

data2 = +1

Interleaving 2:

Thr#2: s3

Thr#2: s4

Thr#1: s1

Thr#1: s2

data1=-1

data2 = 0

Scheduling

(Master)

Thread #1…

s1: ask_master (“I’m #1, can I go?”);

tmpx = data1;

s2: ask_master (“I’m #1, can I go?”);

data2 = tmpx+1;

Thread #2…

s3: ask_master (“I’m #2, can I go?”);

tmpy = data2;

s4: ask_master (“I’m #2, can I go?”);

data1 = tmpy-1;

Page 13: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Concurrency Bugs

• Incorrect uses of shared resources

Page 14: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Deadlock

(Bridge Crossing Example)

Page 15: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Lock (A)Read from data1;

Lock (B)Write to data2;Unlock (B)

Unlock (A)

Deadlock

Lock (B)Read from data2;

Lock (A)Write to data1;Unlock (A)

Unlock (B)

Both threads get stuck waiting for locks held by others

Page 16: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Data Race

Lock (A)Read from data1;

/* Lock (B) */Write to data2;/* Unlock (B) */

Unlock (A)

Lock (B)Read from data2;

Lock (A)Write to data1;Unlock (A)

Unlock (B)

Un-protected accesses to shared variable (data2)

Page 17: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Data Race

(Bridge Crossing Example)

Page 18: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Atomicity Violation

The red cars must stay together…

Page 19: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Atomicity Violation

If (p != NULL) {

Write to p->x;

}

p := NULL;

The “check” and “use” should not be interrupted

Page 20: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

For detecting assertion failures

Interrupt Service Routine (ISR) of a 16-bit microcontroller

Therac 25 radiation therapy machine 1985-1987, six accidents

of massive overdose (100 times) due to a concurrency bug

Page 21: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

For detecting assertion failures

Found a data race between

(tid=0, obj_write , obj_id=7, obj_val=0) and

(tid=1, obj_write , obj_id=7, obj_val=0)

……

@@@: Caught Assert Exception

===================================

Inspect: Total number of runs: 9, killed-in-the-middle runs: 0

Inspect: Transitions explored: 1837

Inspect: Used time (seconds): 2.506451

===================================

code-transformation to build

& run the SW on 32-bit Linux

(original code runs on bare-

metal w/o OS)

Interrupt Service Routine (ISR) of a 16-bit microcontroller

INSPECT: Developed by

Yu Yang et al., Univ. Utah

Page 22: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

For detecting concurrency bugs

• Incorrect uses of shared resources

– Deadlocks,

– Data races,

– Atomicity violations,

– Order violations,

– Type-state violations,

– Linearizability violations,

– etc.

Page 23: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Problem: too many interleavings

• Exponential in the worst case …

• Partial Order Reduction (POR)

– Classify interleavings into several equivalence classes,

and from each class, test only one “representative”…

Page 24: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

More scalableMore general but less scalable

SPIN [Holzmann 1980,1991]

Verisoft [Godefroid 1997,2005]

CHESS [Musuvathi et al, 2007]

Inspect [Yang et al, 2008]

Java Pathfinder [Visser et al, 2004]

[Wang et al, FSE 2009]Symbolic Pruning (beyond POR)

POR

Dynamic POR& context bounding

Page 25: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

POR not good enough: Why?

• Equivalence is based on “data conflicts”

a = A[x]

A[x] = 10

Interleaving #1

a = A[x]

A[x] = 10

Interleaving #2

A[x]=5 initially

a is 5

a is 10

They are not equivalent!

Page 26: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Symbolic Pruning: main idea

• Tracking “flow of data” to assess impact

a = A[x]if (a>0)

{…}

A[x] = 10

a = A[x]if (a>0)

{…}

A[x] = 10

Interleaving #1 Interleaving #2

A[x]=5 initially

(a>0) istrue

(a>0) istrue

They Are Still Equivalent!

Page 27: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Experiments (Symbolic Pruning vs. POR)

Number of

Threads

Runtime

(seconds)

Concurrent threads writing to a shared “hash table”

Example from DPOR paper [Flanagan & Godefroid, POPL 2005]

[Wang et al. FSE 2009]

NEW

Page 28: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Monitoring: …useful but …

• Still too expensive for larger applications

Page 29: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Outline

• Embedded Systems Software: Why?

• Concurrent Programs: Why?

• Symbolic Predictive Analysis

– Part I: Monitoring

– Part II: Predicting

• Conclusions & Future Work

Page 30: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Predictive Analysis

• Detecting bugs by statically analyzing a logged

execution trace without re-running the program…

Page 31: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Predictive Analysis

Predictive Model

Inferred Trace

Search Space

Given Trace

(cf. K. Sen, G. Rosu)

Page 32: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Predicting Errors: How?

• Given run is good, but …

Thread1

e1: if ( buf_index + len < BUFFSIZE) {

e2: memcpy(buf[buf_index], log, len);

}

Thread2

e3: buf_index + =len;

Page 33: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Predicting Errors: How?

• Given run is good, but an alternative run is buggy

Thread1

e1: if ( buf_index + len < BUFFSIZE) {

e2: memcpy(buf[buf_index], log, len);

}

Thread2

e3: buf_index + =len;

Buffer Overflow (caused by a TOCTTOU error) is a major security vulnerability –responsible for numerous software exploits in the past decade.

Page 34: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Two Existing Approaches

Page 35: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

(1) Happens-Before Methods

• Start with totally ordered events (the given trace)

– Try to relax some of these ordering constraints

Read X

Read X

Write Y

Read Y

Write X

Read X

Read X

Write Y

Read Y

Write X

inferred

Page 36: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

More

real traces

Fewer

real traces

Trace (total order)

Happens-before

[Lamport 1978]

[Sen,Rosu 2003]

[Chen,Rosu 2007]

MCM (Maximum Causal Model)

[Serbanuta,Chen,Rosu 2008]

HigherCoverage

Page 37: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

(2) Lock-Set Based Methods

• Start with un-ordered events (of the given trace)

– Use lock/unlock to impose ordering constraints

Read X

unlock(A)

lock (A)

lock (A)

Write X

Read X

unlock(A)

lock (A)

lock (A)

Write X

removed

Page 38: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

More

bogus

traces

Fewer

bogus

traces

Lock Acquisition History

[Kahlon 2005]

Lock-set

[Savage 1997]

Higher Precision

UCG (Universal Causality Graph)

[Kahlon & Wang, CAV 2010]

Trace(notordered)

Page 39: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Universal Causality Graph (UCG)

• For deciding “control-state reachability”

– Sound and complete for 2 threads

– Sound for >2 threads

[Kahlon & Wang, CAV 2010]

Page 40: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Experiments (UCG is more precise)

1

10

100

1000

10000

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

lockset

must-hb

UCG

Number of

warnings

Different Test Cases

Detecting Atomicity Violations [Kahlon & Wang, CAV 2010]

Page 41: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

More

bogus

traces

More

real traces

Fewer

real traces

Fewer

bogus

traces

Trace

(total order)

Happens-before

[Lamport 1978]

[Sen,Rosu 2003]

[Chen,Rosu 2007]

MCM (Maximum Causal Model)

[Serbanuta,Chen,Rosu 2008]

Lock Acquisition History

[Kahlon 2005]

Lock-set

[Savage 1997]

Higher Precision

HigherCoverage

UCG (Universal Causality Graph)

[Kahlon & Wang, CAV 2010]

SMT for data-race detection[Said et al., NFM 2011]

Trace

(not

ordered)

Page 42: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

public class Data{

public static int x;

public static boolean s= false;

public static void main(String[] args){

Class o = Data.class;

Thread t2 = new Thread (new Task());

t2.start();

Data.x = 1;

synchronized (o){

Data.x = 0;

if(!Data.s){

try{

o.wait();

}catch(Exception ex){}

}

}

}

}

class Task implements Runnable {

Class o = Data.class;

public void run() {

int a,b;

synchronized (o){

a = Data.x;

Data.s = true;

o.notifyAll();

}

b = Data.x;

}

}

Running Example [Said, Wang, Sakallah,&Yang, NFM 2011]

Page 43: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

public class Data{

public static int x;

public static boolean s= false;

public static void main(String[] args){

Class o = Data.class;

Thread t2 = new Thread (new Task());

t2.start();

Data.x = 1;

synchronized (o){

Data.x = 0;

if(!Data.s){

try{

o.wait();

}catch(Exception ex){}

}

}

}

}

class Task implements Runnable {

Class o = Data.class;

public void run() {

int a,b;

synchronized (o){

a = Data.x;

Data.s = true;

o.notifyAll();

}

b = Data.x;

}

}

tid type var value

log event

Running Example

Data-races?

[Said, Wang, Sakallah,&Yang, NFM 2011]

Page 44: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

t2.start();x = 1;synchronized (o) {

x = 0;if(!s)

o.wait(); }

synchronized (o){a = x;s = true;o.notifyAll();

} b = x;

Execution

Thread 1

Thread 2

1 fork - 2

Execution Trace

Page 45: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

t2.start();x = 1;synchronized (o) {

x = 0;if(!s)

o.wait(); }

synchronized (o){a = x;s = true;o.notifyAll();

} b = x;

Thread 1

Thread 2

1 write x 1

Execution Trace

Execution1 fork - 2

Page 46: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

t2.start();x = 1;synchronized (o) {

x = 0;if(!s)

o.wait(); }

synchronized (o){a = x;s = true;o.notifyAll();

} b = x;

Execution

Thread 1

Thread 2

1 fork - 2

1 write x 1

1 acquire o -

Execution Trace

Page 47: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

t2.start();x = 1;synchronized (o) {

x = 0;if(!s)

o.wait(); }

synchronized (o){a = x;s = true;o.notifyAll();

} b = x;

Execution

Thread 1

Thread 2

1 fork - 2

1 write x 1

1 acquire o -

1 write x 0

Execution Trace

Page 48: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

t2.start();x = 1;synchronized (o) {

x = 0;if(!s)

o.wait(); }

synchronized (o){a = x;s = true;o.notifyAll();

} b = x;

Execution

Thread 1

Thread 2

1 fork - 2

1 write x 1

1 acquire o -

1 write x 0

1 read s F

Execution Trace

Page 49: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

t2.start();x = 1;synchronized (o) {

x = 0;if(!s)

o.wait(); }

synchronized (o){a = x;s = true;o.notifyAll();

} b = x;

Execution

Thread 1

Thread 2

1 fork - 2

1 write x 1

1 acquire o -

1 write x 0

1 read s F

1 wait o -

Execution Trace

Page 50: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

t2.start();x = 1;synchronized (o) {

x = 0;if(!s)

o.wait(); }

synchronized (o){a = x;s = true;o.notifyAll();

} b = x;

Execution

Thread 1

Thread 2

1 fork - 2

1 write x 1

1 acquire o -

1 write x 0

1 read s F

1 wait o -

2 acquire o -

Execution Trace

Page 51: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

t2.start();x = 1;synchronized (o) {

x = 0;if(!s)

o.wait(); }

synchronized (o){a = x;s = true;o.notifyAll();

} b = x;

Execution

Thread 1

Thread 2

1 fork - 2

1 write x 1

1 acquire o -

1 write x 0

1 read s F

1 wait o -

2 acquire o -

2 read x 0

Execution Trace

Page 52: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

t2.start();x = 1;synchronized (o) {

x = 0;if(!s)

o.wait(); }

synchronized (o){a = x;s = true;o.notifyAll();

} b = x;

Execution

Thread 1

Thread 2

1 fork - 2

1 write x 1

1 acquire o -

1 write x 0

1 read s F

1 wait o -

2 acquire o -

2 read x 0

2 write s T

Execution Trace

Page 53: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

t2.start();x = 1;synchronized (o) {

x = 0;if(!s)

o.wait(); }

synchronized (o){a = x;s = true;o.notifyAll();

} b = x;

Execution

Thread 1

Thread 2

1 fork - 2

1 write x 1

1 acquire o -

1 write x 0

1 read s F

1 wait o -

2 acquire o -

2 read x 0

2 write s T

2 notifyall o -

Execution Trace

Page 54: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

t2.start();x = 1;synchronized (o) {

x = 0;if(!s)

o.wait(); }

synchronized (o){a = x;s = true;o.notifyAll();

} b = x;

Execution

Thread 1

Thread 2

1 fork - 2

1 write x 1

1 acquire o -

1 write x 0

1 read s F

1 wait o -

2 acquire o -

2 read x 0

2 write s T

2 notifyall o -

2 release o -

Execution Trace

Page 55: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

t2.start();x = 1;synchronized (o) {

x = 0;if(!s)

o.wait(); }

synchronized (o){a = x;s = true;o.notifyAll();

} b = x;

Execution

Thread 1

Thread 2

1 fork - 2

1 write x 1

1 acquire o -

1 write x 0

1 read s F

1 wait o -

2 acquire o -

2 read x 0

2 write s T

2 notifyall o -

2 release o -

2 read x 0

Execution Trace

Page 56: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

t2.start();x = 1;synchronized (o) {

x = 0;if(!s)

o.wait(); }

synchronized (o){a = x;s = true;o.notifyAll();

} b = x;

Execution

Thread 1

Thread 2

1 fork - 2

1 write x 1

1 acquire o -

1 write x 0

1 read s F

1 wait o -

2 acquire o -

2 read x 0

2 write s T

2 notifyall o -

2 release o -

2 read x 0

1 release o -

Execution Trace

This trace may not be buggy

Page 57: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Execution Analysis

Execution1 fork - 2

1 write x 1

1 acquire o -

1 write x 0

1 read s F

1 wait o -

2 acquire o -

2 read x 0

2 write s T

2 notifyall o -

2 release o -

2 read x 0

1 release o -

Symbolic

Predictive Analysis

Page 58: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Partial Order

1 fork - 2

1 write x 1

1 acquire o -

1 write x 0

1 read s F

1 wait o -

2 acquire o -

2 read x 0

2 write s T

2 notifyall o -

2 release o -

2 read x 0

1 release o -

E0 < E1 < E2 < E3 < E4 < E5 < E12

E6 < E7 < E8 < E9 < E10 < E11

&

E0 < E6

&

E0

E1

E2

E3

E4

E5

E6

E7

E8

E9

E10

E11

E12

Page 59: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Write-Read Consistency

1 write x 1E1

1 write x 0E3

2 read x 0E7

E7 < E1OR E3 < E7

Page 60: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Synchronization Consistency[Said, Wang, Sakallah,&Yang, NFM 2011]

Page 61: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Existence of Bugs

• E1 (Write X) and E11 (Read X) has a potential data race

• Adding two happens-before constraints

E1 E11

E0 E10

E11 < E0AND E1 < E10

Data Race

Page 62: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Constraints

Page 63: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Data-Race / Atomicity Violation1 fork - 2

1 write x 1

1 acquire o -

1 write x 0

1 read s F

1 wait o -

2 acquire o -

2 read x 0

2 write s T

2 notifyall o -

2 release o -

2 read x 0

1 release o -

Normal execution without data race as there are

no conflict access enabled at the same time

Witness is a valid execution with conflicting

accesses enabled simultaneously

Page 64: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

More

bogus

traces

More

real traces

Fewer

real traces

Fewer

bogus

traces

Trace

(total order)

Happens-before

[Lamport 1978]

[Sen,Rosu 2003]

[Chen,Rosu 2007]

MCM (Maximum Causal Model)

[Serbanuta,Chen,Rosu 2008]

Lock Acquisition History

[Kahlon 2005]

Lock-set

[Savage 1997]

Higher Precision

HigherCoverage

UCG (Universal Causality Graph)

[Kahlon & Wang, CAV 2010]

CTP (Concurrent Trace Program)

[Wang et al., FM 2009]

Trace

(not

ordered)

Page 65: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Outline

• Embedded Systems: Why?

• Concurrent Programs: Why?

• Symbolic Predictive Analysis

– Part I: Monitoring

– Part II: Predicting (CTP)

• Fusion Research Vision

Page 66: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

C/C++ program:

multi-threaded, using Pthreads

Execution trace

“assume( c )” means if (c)-branch is taken

Page 67: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

CTP (concurrent trace program)

Execution trace

Think of them asbounded, straight-line, sequential programs

Page 68: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Precise for Detecting Bugs

• Bugs found in CTP are always real bugs

– Concurrency bugs

Page 69: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Why is CTP a Good Model?

CTP is like a …

Page 70: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Symbolic Analysis

• Capturing valid executions in SAT/SMT formulas

– Relations over variables/events

– Not interleaved traces

• Decide formulas

– Satisfiable � Found a bug

– Unsatisfable…

[Wang et al., FM09]

[Wang et al., TACAS10]

Page 71: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Constructing Formulas

F_po: HB(t0,t1) & HB(t1,t2) & HB(t2,t3) & HB(t3,t4) & HB(t4,t5)

HB(t0,t11) & HB(t11,t12) & HB(t12,t13) & HB(t13,t14) & HB(t14,15) & HB(t15,t18) & HB(t18,t5)

HB(t1,t21) & HB(t21,t26) & HB(t26,t27) & HB(t27,t28) & HB(t28,t4)

F_vd: (x0=0) & (y0=0) &

(a1=Y_1) & & (b1 = X_1)

(a1=0) & & (b1 != 0)

(x1=1) & & (y1 = 0)

(a2=X_2+1) &

(x2=a2)

F_property: (X_3 == Y_2)

F_pi: &( (Y_1=y0) & HB(t11,t27) OR

(Y_1=y1) & HB(t27,t11) )

& ( (X_1=x0) & HB(t21,t13) OR

(X_1=x1) & HB(t13,t21) & HB(t21,t15) OR

(X_1=x2) & HB(t15,t21) )

& (X_2=x1)

& (X_3=x2)

& (Y_2=y1)

[Wang et al., FM09]

[Wang et al., TACAS10]

Page 72: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Our Approach (constraint-based)

• Flexible

– Everything boils down to a set of “constraints”

Page 73: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Our Approach (constraint-based)

• Flexible

• Efficient

– SMT solver based symbolic search

Page 74: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Our Approach (constraint-based)

• Flexible

• Efficient

• Precise

– It’s a precise analysis (data flow + control flow)

Page 75: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Experiments (tracking data flow is better)

0

5

10

15

20

25

30

35

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

w/o Data

Symbolic

Number of

warnings

Different Test Cases

Detecting Atomicity Violations [Wang et al., TACAS 2010]

Page 76: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Constraint-Based Approach

• Flexible

• Efficient

• Precise

• Compositional

– Encode each thread, and then compose threads with

“interference constraints”

Page 77: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Composing Incrementally

F_po: HB(t0,t1) & HB(t1,t2) & HB(t2,t3) & HB(t3,t4) & HB(t4,t5)

HB(t0,t11) & HB(t11,t12) & HB(t12,t13) & HB(t13,t14) & HB(t14,15) & HB(t15,t18) & HB(t18,t5)

HB(t1,t21) & HB(t21,t26) & HB(t26,t27) & HB(t27,t28) & HB(t28,t4)

F_vd: (x0=0) & (y0=0) &

(a1=Y_1) & & (b1 = X_1)

(a1=0) & & (b1 != 0)

(x1=1) & & (y1 = 0)

(a2=X_2+1) &

(x2=a2)

F_property: (X_3 == Y_2)

F_pi: &( (Y_1=y0) & HB(t11,t27) OR

(Y_1=y1) & HB(t27,t11) )

& ( (X_1=x0) & HB(t21,t13) OR

(X_1=x1) & HB(t13,t21) & HB(t21,t15) OR

(X_1=x2) & HB(t15,t21) )

& (X_2=x1)

& (X_3=x2)

& (Y_2=y1)

Interference constraints

Page 78: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Compositionality is useful

• Example

– Add “interference constraints” on a need-to basis

F_pi: &( (Y_1=y0) & HB(t11,t27) OR

(Y_1=y1) & HB(t27,t11) )& ( (X_1=x0) & HB(t21,t13) OR

(X_1=x1) & HB(t13,t21) & HB(t21,t15) OR(X_1=x2) & HB(t15,t21) )

& (X_2=x1) & (X_3=x2)& (Y_2=y1)

F_pi: & (Y_1=*)

& (X_1=*)

& (X_2=*) & (X_3=*)& (Y_2=*)

F_pi: & (Y_1=*)

& (X_1=*)

& (X_2=x1) & (X_3=x2)& (Y_2=y1)

F_pi: & ( (Y_1=y0) OR

(Y_1=y1) )& (X_1=*)

& (X_2=x1) & (X_3=x2)& (Y_2=y1)

F_pi: & ( (Y_1=y0) & HB(t11,t27) OR

(Y_1=y1) & HB(t27,t11) )& (X_1=*)

& (X_2=x1) & (X_3=x2)& (Y_2=y1)

Page 79: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

More

bogus

traces

More

real traces

Fewer

real traces

Fewer

bogus

traces

Trace

(total order)CTP

Higher Precision

HigherCoverage

Trace

(not

ordered)

Interference Abstraction[Sinha & Wang, POPL 2011]

Good Enough

Page 80: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Experiments (iterative refinement is much faster)

1

10

100

1000

10000

1 2 3 4 5 6 7 8 9 10 11 12 13 14

Symbolic

Sym-IA

Runtime (secons)

Different Test Cases

[Sinha & Wang, POPL 2011]

Page 81: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Conclusions

• Concurrent Trace Program (CTP)

• Symbolic Predictive Analysis

Static Analysis(UCG)

Symbolic Analysis(SMT-based)

Interference Abs(Ref)

Page 82: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Related Work

• Some other symbolic analysis methods

– [Sinha & Wang, FSE 2010],

– [Sinha & Wang, POPL 2011]

– [Alglave, Kroening &Tautschnig, CAV 2013]

– …

• Applications of “symbolic predictive analysis”– HW deterministic replay under TSO [Lee et al., HPCA11]

– SW deterministic replay [Huang & Zhang, PLDI’13]

– Null pointer detection [Farzan et al., FSE’12]

– Deadlock detection [Eslamimehr & Palsberg, FSE’14]

– …

Page 83: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Our Recent Work (brief overview)

DetectingConcurrency Failures

MitigatingConcurrency Failures

OptimizingSynchronization Code

Page 84: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Lock Removal (Ex.1)

a0: -------;a1: lock(l1);a2: a[1]++;a3: unlock(l1);a4: a[2]++;a5: lock(l1);a6: lock(l2);a7: a[3]++;a8: unlock(l2);a9: unlock(l1);a10: sh++;

b0: -------;

b1: a[10]++;

b2: a[11]++;

b3: lock(l1);

b4: lock(l2);

b5: a[12]++;

b6: unlock(l2);

b7: unlock(l2);

b8: sh++;

b9: --------;

Lock Removal in Concurrent Trace Programs [Kahlon & Wang, CAV 2012]

Page 85: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Lock Removal (Ex.1)

a0: -------;a1: lock(l1);a2: a[1]++;a3: unlock(l1);a4: a[2]++;a5: lock(l1);a6: lock(l2);a7: a[3]++;a8: unlock(l2);a9: unlock(l1);a10: sh++;

b0: -------;

b1: a[10]++;

b2: a[11]++;

b3: lock(l1);

b4: lock(l2);

b5: a[12]++;

b6: unlock(l2);

b7: unlock(l2);

b8: sh++;

b9: --------;

Lock Removal in Concurrent Trace Programs [Kahlon & Wang, CAV 2012]

Page 86: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Lock Removal (Ex.1)

a0: -------;a1: lock(l1);a2: a[1]++;a3: unlock(l1);a4: -------;a5: lock(l1);a6: lock(l2);a7: a[3]++;a8: unlock(l2);a9: unlock(l1);a10: sh++;

b0: -------;

b1: a[10]++;

b2: a[11]++;

b3: lock(l1);

b4: lock(l2);

b5: a[12]++;

b6: unlock(l2);

b7: unlock(l2);

b8: sh++;

b9: --------;

Lock Removal in Concurrent Trace Programs [Kahlon & Wang, CAV 2012]

Page 87: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Lock Removal (Ex.1)

a0: -------;a1: lock(l1);a2: -------;a3: unlock(l1);a4: -------;a5: lock(l1);a6: lock(l2);a7: -------;a8: unlock(l2);a9: unlock(l1);a10: sh++;

b0: -------;

b1: -------;

b2: -------;

b3: lock(l1);

b4: lock(l2);

b5: -------;

b6: unlock(l2);

b7: unlock(l2);

b8: sh++;

b9: --------;

Lock Removal in Concurrent Trace Programs [Kahlon & Wang, CAV 2012]

Page 88: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Lock Removal (Ex.1)

a0: -------;a1: lock(l1);a2: -------;a3: unlock(l1);a4: -------;a5: lock(l1);a6: lock(l2);a7: -------;a8: unlock(l2);a9: unlock(l1);a10: sh++;

b0: -------;

b1: -------;

b2: -------;

b3: lock(l1);

b4: lock(l2);

b5: -------;

b6: unlock(l2);

b7: unlock(l2);

b8: sh++;

b9: --------;

Lock Removal in Concurrent Trace Programs [Kahlon & Wang, CAV 2012]

Page 89: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Lock Removal (Ex.1)

a0: -------;a1: -------;a2: -------;a3: -------;a4: -------;a5: lock(l1);a6: lock(l2);a7: -------;a8: unlock(l2);a9: unlock(l1);a10: sh++;

b0: -------;

b1: -------;

b2: -------;

b3: lock(l1);

b4: lock(l2);

b5: -------;

b6: unlock(l2);

b7: unlock(l2);

b8: sh++;

b9: --------;

Lock Removal in Concurrent Trace Programs [Kahlon & Wang, CAV 2012]

Page 90: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Lock Removal (Ex.1)

a0: -------;a1: -------;a2: -------;a3: -------;a4: -------;a5: -------;a6: -------;a7: -------;a8: -------;a9: -------;a10: sh++;

b0: -------;

b1: -------;

b2: -------;

b3: -------;

b4: -------;

b5: -------;

b6: -------;

b7: -------;

b8: sh++;

b9: --------;

Lock Removal in Concurrent Trace Programs [Kahlon & Wang, CAV 2012]

Page 91: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Lock Removal (Example 2)

a0: sh++;

a1: -------;

a2: lock(l1);

a3: -------;

a4: unlock(l1);

a5: -------;

a6: -------;

a7: sh++;

a8: -------;

a9: -------;

b0: -------;

b1: lock(l1);

b2: sh = 0;

b3: -------;

b4: x = sh;

b5: -------;

b6: unlock(l1);

b7: -------;

b8: assert(x != 2);

b9: --------;

Lock Removal in Concurrent Trace Programs [Kahlon & Wang, CAV 2012]

Page 92: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Lock Removal (Example 2)

a0: sh++;

a1: -------;

a2: lock(l1);

a3: -------;

a4: unlock(l1);

a5: -------;

a6: -------;

a7: sh++;

a8: -------;

a9: -------;

b0: -------;

b1: lock(l1);

b2: sh = 0;

b3: -------;

b4: x = sh;

b5: -------;

b6: unlock(l1);

b7: -------;

b8: assert(x != 2);

b9: --------;

Lock Removal in Concurrent Trace Programs [Kahlon & Wang, CAV 2012]

Cannot be removed althoughIt seem to be doing nothing

Page 93: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Lock Removal (Example 2)

a0: sh++;

a1: -------;

a2: lock(l1);

a3: -------;

a4: unlock(l1);

a5: -------;

a6: -------;

a7: sh++;

a8: -------;

a9: -------;

b0: -------;

b1: lock(l1);

b2: sh = 0;

b3: -------;

b4: x = sh;

b5: -------;

b6: unlock(l1);

b7: -------;

b8: assert(x != 2);

b9: --------;

Lock Removal in Concurrent Trace Programs [Kahlon & Wang, CAV 2012]

Cannot be removed althoughIt seem to be doing nothing

Page 94: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Lock Removal (Example 2)

a0: sh++;

a1: -------;

a2: lock(l1);

a3: -------;

a4: unlock(l1);

a5: -------;

a6: -------;

a7: sh++;

a8: -------;

a9: -------;

b0: -------;

b1: lock(l1);

b2: sh = 0;

b3: -------;

b4: x = sh;

b5: -------;

b6: unlock(l1);

b7: -------;

b8: assert(x != 2);

b9: --------;

Cannot be removed althoughIt seem to be doing nothing

Page 95: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Results: for improving predictive bug detection

Lock Removal in Concurrent Trace Programs [Kahlon & Wang, CAV 2012]

Page 96: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Our Recent Work (brief overview)

DetectingConcurrency Failures

MitigatingConcurrency Failures

OptimizingSynchronization Code

Page 97: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Multi-threaded Client Program

Type-State Violations

Concurrency related API usage rule violations

Type-State Automaton

showing correct usage rules

of a shared object library

Page 98: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Runtime Failure Mitigation

• Resilient system on potentially unreliable components

– Hardening client program with API usage rules• Only correct method call sequences are produced

• Correctness is defined by “type-state automaton”

Component

Library Code

Client Program

Code (original)

Merge &

Compile

Type-state

Automaton

Executable

(resilient)

Program Code

(hardened)

Inserting Runtime

Monitor & Controller

Page 99: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Runtime Failure Mitigation

• To perturb thread interleavings by a lookahead analysis

• Delay a method call if it leads to the “doomed” state

AF (bad)

Page 100: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

ResultsRuntime Prevention of Concurrency Related Type-State Violations

[Zhang & Wang ISSTA 2014]

Open source C/C++ applications

in the fieldAverage runtime overhead: 2.36%

Page 101: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

ResultsRuntime Prevention of Concurrency Related Type-State Violations

[Zhang & Wang ISSTA 2014]

Open source C/C++ applications

in the field

Average runtime overhead: 2.36%

Page 102: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Our Recent Work

DetectingConcurrency Failures

MitigatingConcurrency Failures

OptimizingEmbedded Software

Page 103: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Today’s Talk

• Performance• Reliability• Security

Embedded Software- C/C++ program- Numerical analysis - Abstract interpretation

Concurrent Software- Multi-core, multi-threaded - Concurrency- Symbolic predictive analysis

Cryptographic Software- Security and Privacy- Power side channel - SMT based analysis

VLSI Circuits

- Finite state machine- Boolean analysis - Model checking

Univ. Colorado, Boulder

2000-2004

NEC Labs, Princeton

2004-2011

Virginia Tech, Blacksburg

2011-present

Page 104: SMT for Cryptographic & Concurrent Software Verification ...€¦ · SMT for Cryptographic & Concurrent Software Verification (Part I) ... Apps Programming Models ... Total number

Let’s take a break…