Top Banner
Typestate-guided Exploration of Interleavings Using SMT Robert Frohardt and Jonathan Turner (with help from Devin Coughlin, Bor- Yuh Evan Chang, and Sriram Sankaranarayanan)
14

Typestate-guided Exploration of Interleavings Using SMT Robert Frohardt and Jonathan Turner (with help from Devin Coughlin, Bor-Yuh Evan Chang, and Sriram.

Dec 19, 2015

Download

Documents

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: Typestate-guided Exploration of Interleavings Using SMT Robert Frohardt and Jonathan Turner (with help from Devin Coughlin, Bor-Yuh Evan Chang, and Sriram.

Typestate-guided Exploration of Interleavings Using SMT

Robert Frohardt and Jonathan Turner

(with help from Devin Coughlin, Bor-Yuh Evan Chang, and Sriram Sankaranarayanan)

Page 2: Typestate-guided Exploration of Interleavings Using SMT Robert Frohardt and Jonathan Turner (with help from Devin Coughlin, Bor-Yuh Evan Chang, and Sriram.

Outline

Motivation Example SMT Encoding Results Future Work Conclusion

Page 3: Typestate-guided Exploration of Interleavings Using SMT Robert Frohardt and Jonathan Turner (with help from Devin Coughlin, Bor-Yuh Evan Chang, and Sriram.

Motivation

Concurrent programs are difficult to test

Page 4: Typestate-guided Exploration of Interleavings Using SMT Robert Frohardt and Jonathan Turner (with help from Devin Coughlin, Bor-Yuh Evan Chang, and Sriram.

Motivation

Concurrent programs are difficult to test Many possible thread interleavings

Thread 1 Thread 2

Page 5: Typestate-guided Exploration of Interleavings Using SMT Robert Frohardt and Jonathan Turner (with help from Devin Coughlin, Bor-Yuh Evan Chang, and Sriram.

Motivation

Concurrent programs are difficult to test Many possible thread interleavings

Instead, use SMT solver to explore interleavings automatically

Thread 1 Thread 2

Page 6: Typestate-guided Exploration of Interleavings Using SMT Robert Frohardt and Jonathan Turner (with help from Devin Coughlin, Bor-Yuh Evan Chang, and Sriram.

Example

*x = 42

Thread Spawn b

Monitor Enter o

x = Null

Monitor Exit o

Thread Join b

Monitor Enter o

print *x

Monitor Exit o

Thread a

Thread b

Page 7: Typestate-guided Exploration of Interleavings Using SMT Robert Frohardt and Jonathan Turner (with help from Devin Coughlin, Bor-Yuh Evan Chang, and Sriram.

a1: Thread Spawn b

a2: Monitor Enter o

a3: x = Null

a5: Thread Join b

b0: Monitor Enter o

b1: print *x

b2: Monitor Exit oa

4: Monitor Exit o

a0: *x = 42

Possible Race Condition

Example

Page 8: Typestate-guided Exploration of Interleavings Using SMT Robert Frohardt and Jonathan Turner (with help from Devin Coughlin, Bor-Yuh Evan Chang, and Sriram.

Typestates

Not Null Null

Error

Deref

Set nullSet null

Set not null

Deref

Set not null

Page 9: Typestate-guided Exploration of Interleavings Using SMT Robert Frohardt and Jonathan Turner (with help from Devin Coughlin, Bor-Yuh Evan Chang, and Sriram.

a1: Thread Spawn b

a2: Monitor Enter o

a3: x = Null

a5: Thread Join b

b0: Monitor Enter o

b1: print *x

b2: Monitor Exit oa

4: Monitor Exit o

a0: *x = 42 Encoding

Synchronization

Page 10: Typestate-guided Exploration of Interleavings Using SMT Robert Frohardt and Jonathan Turner (with help from Devin Coughlin, Bor-Yuh Evan Chang, and Sriram.

a1: Thread Spawn b

a2: Monitor Enter o

a3: x = Null

a5: Thread Join b

b0: Monitor Enter o

b1: print *x

b2: Monitor Exit oa

4: Monitor Exit o

a0: *x = 42 Encoding

Synchronization

Page 11: Typestate-guided Exploration of Interleavings Using SMT Robert Frohardt and Jonathan Turner (with help from Devin Coughlin, Bor-Yuh Evan Chang, and Sriram.

Results

Page 12: Typestate-guided Exploration of Interleavings Using SMT Robert Frohardt and Jonathan Turner (with help from Devin Coughlin, Bor-Yuh Evan Chang, and Sriram.

Future Work

Complement dynamic analysis with static analysis of control flow

Encode the typestate model for the SMT solver Prune long error witnesses Determine feasibility of interleaving in original

program

Page 13: Typestate-guided Exploration of Interleavings Using SMT Robert Frohardt and Jonathan Turner (with help from Devin Coughlin, Bor-Yuh Evan Chang, and Sriram.

Conclusion

Difficult to discover bad interleavings with traditional testing

But, we can explore interleavings using a trace, a typestate model, and an SMT solver

Limitations to the current approach, but we hope to address these in future iterations

Page 14: Typestate-guided Exploration of Interleavings Using SMT Robert Frohardt and Jonathan Turner (with help from Devin Coughlin, Bor-Yuh Evan Chang, and Sriram.

Questions?