Optimizing Constraint Solving to Better Support Symbolic Execution - - PowerPoint PPT Presentation

optimizing constraint solving to better support symbolic
SMART_READER_LITE
LIVE PREVIEW

Optimizing Constraint Solving to Better Support Symbolic Execution - - PowerPoint PPT Presentation

Optimizing Constraint Solving to Better Support Symbolic Execution Ikpeme Erete and Alessandro Orso School of Computer Science College of Computing Georgia Institute of Technology Partially supported by : NSF, IBM, and MSR Background:


slide-1
SLIDE 1

Optimizing Constraint Solving to Better Support Symbolic Execution

Ikpeme Erete and Alessandro Orso

School of Computer Science – College of Computing Georgia Institute of Technology

Partially supported by: NSF, IBM, and MSR

slide-2
SLIDE 2

Background: Dynamic Symbolic Execution

  • 01. foo(int a, int b, int c, int d) {
  • 02. if (c > a)
  • 03. int e=d+10
  • 04. if (b > 5)
  • 05. // do something
  • 06. else if (a < e)
  • 07. if (b < c)
  • 08. // do something
  • 09. else
  • 10. // do something
  • 11. else
  • 12. // do something
  • 13. return
  • 14. }

Inputs: a=4, b= 5, c=6, d=1 Executed branches: Symbolic state: Path condition (PC): DSE:

slide-3
SLIDE 3

Background: Dynamic Symbolic Execution

  • 01. foo(int a, int b, int c, int d) {
  • 02. if (c > a)
  • 03. int e=d+10
  • 04. if (b > 5)
  • 05. // do something
  • 06. else if (a < e)
  • 07. if (b < c)
  • 08. // do something
  • 09. else
  • 10. // do something
  • 11. else
  • 12. // do something
  • 13. return
  • 14. }

Inputs: a=4, b= 5, c=6, d=1 Executed branches: Symbolic state: Path condition (PC): DSE: a=a0, b=b0, c=c0, d=d0

slide-4
SLIDE 4

Background: Dynamic Symbolic Execution

  • 01. foo(int a, int b, int c, int d) {
  • 02. if (c > a)
  • 03. int e=d+10
  • 04. if (b > 5)
  • 05. // do something
  • 06. else if (a < e)
  • 07. if (b < c)
  • 08. // do something
  • 09. else
  • 10. // do something
  • 11. else
  • 12. // do something
  • 13. return
  • 14. }

Inputs: a=4, b= 5, c=6, d=1 Executed branches: Symbolic state: Path condition (PC): DSE: a=a0, b=b0, c=c0, d=d0

slide-5
SLIDE 5

Background: Dynamic Symbolic Execution

  • 01. foo(int a, int b, int c, int d) {
  • 02. if (c > a)
  • 03. int e=d+10
  • 04. if (b > 5)
  • 05. // do something
  • 06. else if (a < e)
  • 07. if (b < c)
  • 08. // do something
  • 09. else
  • 10. // do something
  • 11. else
  • 12. // do something
  • 13. return
  • 14. }

Inputs: a=4, b= 5, c=6, d=1 Executed branches: Symbolic state: Path condition (PC): DSE: 2T, a=a0, b=b0, c=c0, d=d0

slide-6
SLIDE 6

Background: Dynamic Symbolic Execution

  • 01. foo(int a, int b, int c, int d) {
  • 02. if (c > a)
  • 03. int e=d+10
  • 04. if (b > 5)
  • 05. // do something
  • 06. else if (a < e)
  • 07. if (b < c)
  • 08. // do something
  • 09. else
  • 10. // do something
  • 11. else
  • 12. // do something
  • 13. return
  • 14. }

Inputs: a=4, b= 5, c=6, d=1 Executed branches: Symbolic state: Path condition (PC): DSE:

(c0 > a0)

2T, a=a0, b=b0, c=c0, d=d0

slide-7
SLIDE 7

Background: Dynamic Symbolic Execution

  • 01. foo(int a, int b, int c, int d) {
  • 02. if (c > a)
  • 03. int e=d+10
  • 04. if (b > 5)
  • 05. // do something
  • 06. else if (a < e)
  • 07. if (b < c)
  • 08. // do something
  • 09. else
  • 10. // do something
  • 11. else
  • 12. // do something
  • 13. return
  • 14. }

Inputs: a=4, b= 5, c=6, d=1 Executed branches: Symbolic state: Path condition (PC): DSE:

(c0 > a0)

2T, a=a0, b=b0, c=c0, d=d0

slide-8
SLIDE 8

Background: Dynamic Symbolic Execution

  • 01. foo(int a, int b, int c, int d) {
  • 02. if (c > a)
  • 03. int e=d+10
  • 04. if (b > 5)
  • 05. // do something
  • 06. else if (a < e)
  • 07. if (b < c)
  • 08. // do something
  • 09. else
  • 10. // do something
  • 11. else
  • 12. // do something
  • 13. return
  • 14. }

Inputs: a=4, b= 5, c=6, d=1 Executed branches: Symbolic state: Path condition (PC): DSE:

(c0 > a0)

2T, , e=d0+10 a=a0, b=b0, c=c0, d=d0

slide-9
SLIDE 9

Background: Dynamic Symbolic Execution

  • 01. foo(int a, int b, int c, int d) {
  • 02. if (c > a)
  • 03. int e=d+10
  • 04. if (b > 5)
  • 05. // do something
  • 06. else if (a < e)
  • 07. if (b < c)
  • 08. // do something
  • 09. else
  • 10. // do something
  • 11. else
  • 12. // do something
  • 13. return
  • 14. }

Inputs: a=4, b= 5, c=6, d=1 Executed branches: Symbolic state: Path condition (PC): DSE:

(c0 > a0)

2T, , e=d0+10 a=a0, b=b0, c=c0, d=d0

slide-10
SLIDE 10

Background: Dynamic Symbolic Execution

  • 01. foo(int a, int b, int c, int d) {
  • 02. if (c > a)
  • 03. int e=d+10
  • 04. if (b > 5)
  • 05. // do something
  • 06. else if (a < e)
  • 07. if (b < c)
  • 08. // do something
  • 09. else
  • 10. // do something
  • 11. else
  • 12. // do something
  • 13. return
  • 14. }

Inputs: a=4, b= 5, c=6, d=1 Executed branches: Symbolic state: Path condition (PC): DSE:

(c0 > a0)

2T, 4F, , e=d0+10 a=a0, b=b0, c=c0, d=d0

slide-11
SLIDE 11

Background: Dynamic Symbolic Execution

  • 01. foo(int a, int b, int c, int d) {
  • 02. if (c > a)
  • 03. int e=d+10
  • 04. if (b > 5)
  • 05. // do something
  • 06. else if (a < e)
  • 07. if (b < c)
  • 08. // do something
  • 09. else
  • 10. // do something
  • 11. else
  • 12. // do something
  • 13. return
  • 14. }

Inputs: a=4, b= 5, c=6, d=1 Executed branches: Symbolic state: Path condition (PC): DSE:

(c0 > a0) Λ (b0 <= 5)

2T, 4F, , e=d0+10 a=a0, b=b0, c=c0, d=d0

slide-12
SLIDE 12

Background: Dynamic Symbolic Execution

  • 01. foo(int a, int b, int c, int d) {
  • 02. if (c > a)
  • 03. int e=d+10
  • 04. if (b > 5)
  • 05. // do something
  • 06. else if (a < e)
  • 07. if (b < c)
  • 08. // do something
  • 09. else
  • 10. // do something
  • 11. else
  • 12. // do something
  • 13. return
  • 14. }

Inputs: a=4, b= 5, c=6, d=1 Executed branches: Symbolic state: Path condition (PC): DSE:

(c0 > a0) Λ (b0 <= 5)

2T, 4F, , e=d0+10 a=a0, b=b0, c=c0, d=d0

slide-13
SLIDE 13

Background: Dynamic Symbolic Execution

  • 01. foo(int a, int b, int c, int d) {
  • 02. if (c > a)
  • 03. int e=d+10
  • 04. if (b > 5)
  • 05. // do something
  • 06. else if (a < e)
  • 07. if (b < c)
  • 08. // do something
  • 09. else
  • 10. // do something
  • 11. else
  • 12. // do something
  • 13. return
  • 14. }

Inputs: a=4, b= 5, c=6, d=1 Executed branches: Symbolic state: Path condition (PC): DSE:

(c0 > a0) Λ (b0 <= 5)

2T, 4F, 6T, , e=d0+10 a=a0, b=b0, c=c0, d=d0

slide-14
SLIDE 14

Background: Dynamic Symbolic Execution

  • 01. foo(int a, int b, int c, int d) {
  • 02. if (c > a)
  • 03. int e=d+10
  • 04. if (b > 5)
  • 05. // do something
  • 06. else if (a < e)
  • 07. if (b < c)
  • 08. // do something
  • 09. else
  • 10. // do something
  • 11. else
  • 12. // do something
  • 13. return
  • 14. }

Inputs: a=4, b= 5, c=6, d=1 Executed branches: Symbolic state: Path condition (PC): DSE:

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10)

2T, 4F, 6T, , e=d0+10 a=a0, b=b0, c=c0, d=d0

slide-15
SLIDE 15

Background: Dynamic Symbolic Execution

  • 01. foo(int a, int b, int c, int d) {
  • 02. if (c > a)
  • 03. int e=d+10
  • 04. if (b > 5)
  • 05. // do something
  • 06. else if (a < e)
  • 07. if (b < c)
  • 08. // do something
  • 09. else
  • 10. // do something
  • 11. else
  • 12. // do something
  • 13. return
  • 14. }

Inputs: a=4, b= 5, c=6, d=1 Executed branches: Symbolic state: Path condition (PC): DSE:

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10)

2T, 4F, 6T, , e=d0+10 a=a0, b=b0, c=c0, d=d0

slide-16
SLIDE 16

Background: Dynamic Symbolic Execution

  • 01. foo(int a, int b, int c, int d) {
  • 02. if (c > a)
  • 03. int e=d+10
  • 04. if (b > 5)
  • 05. // do something
  • 06. else if (a < e)
  • 07. if (b < c)
  • 08. // do something
  • 09. else
  • 10. // do something
  • 11. else
  • 12. // do something
  • 13. return
  • 14. }

Inputs: a=4, b= 5, c=6, d=1 Executed branches: Symbolic state: Path condition (PC): DSE:

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10)

2T, 4F, 7T 6T, , e=d0+10 a=a0, b=b0, c=c0, d=d0

slide-17
SLIDE 17

Background: Dynamic Symbolic Execution

  • 01. foo(int a, int b, int c, int d) {
  • 02. if (c > a)
  • 03. int e=d+10
  • 04. if (b > 5)
  • 05. // do something
  • 06. else if (a < e)
  • 07. if (b < c)
  • 08. // do something
  • 09. else
  • 10. // do something
  • 11. else
  • 12. // do something
  • 13. return
  • 14. }

Inputs: a=4, b= 5, c=6, d=1 Executed branches: Symbolic state: Path condition (PC): DSE:

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10)

2T, 4F, 7T 6T,

Λ (b0 < c0)

, e=d0+10 a=a0, b=b0, c=c0, d=d0

slide-18
SLIDE 18

Background: Dynamic Symbolic Execution

  • 01. foo(int a, int b, int c, int d) {
  • 02. if (c > a)
  • 03. int e=d+10
  • 04. if (b > 5)
  • 05. // do something
  • 06. else if (a < e)
  • 07. if (b < c)
  • 08. // do something
  • 09. else
  • 10. // do something
  • 11. else
  • 12. // do something
  • 13. return
  • 14. }

Inputs: a=4, b= 5, c=6, d=1 Executed branches: Symbolic state: Path condition (PC): DSE:

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10)

2T, 4F, 7T 6T,

Λ (b0 < c0)

, e=d0+10 a=a0, b=b0, c=c0, d=d0

slide-19
SLIDE 19

Background: Dynamic Symbolic Execution

  • 01. foo(int a, int b, int c, int d) {
  • 02. if (c > a)
  • 03. int e=d+10
  • 04. if (b > 5)
  • 05. // do something
  • 06. else if (a < e)
  • 07. if (b < c)
  • 08. // do something
  • 09. else
  • 10. // do something
  • 11. else
  • 12. // do something
  • 13. return
  • 14. }

Inputs: a=4, b= 5, c=6, d=1 Executed branches: Symbolic state: Path condition (PC): DSE:

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10)

2T, 4F, 7T 6T,

Λ (b0 < c0)

, e=d0+10 a=a0, b=b0, c=c0, d=d0

slide-20
SLIDE 20

Background: Dynamic Symbolic Execution

  • 01. foo(int a, int b, int c, int d) {
  • 02. if (c > a)
  • 03. int e=d+10
  • 04. if (b > 5)
  • 05. // do something
  • 06. else if (a < e)
  • 07. if (b < c)
  • 08. // do something
  • 09. else
  • 10. // do something
  • 11. else
  • 12. // do something
  • 13. return
  • 14. }

Inputs: a=4, b= 5, c=6, d=1 Executed branches: Symbolic state: Path condition (PC): DSE:

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10)

2T, 4F, 7T 6T,

Λ (b0 < c0) (c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10)

, e=d0+10 a=a0, b=b0, c=c0, d=d0

slide-21
SLIDE 21

Background: Dynamic Symbolic Execution

  • 01. foo(int a, int b, int c, int d) {
  • 02. if (c > a)
  • 03. int e=d+10
  • 04. if (b > 5)
  • 05. // do something
  • 06. else if (a < e)
  • 07. if (b < c)
  • 08. // do something
  • 09. else
  • 10. // do something
  • 11. else
  • 12. // do something
  • 13. return
  • 14. }

Inputs: a=4, b= 5, c=6, d=1 Executed branches: Symbolic state: Path condition (PC): DSE:

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10)

2T, 4F, 7T 6T,

Λ (b0 < c0) Λ (b0 >= c0) (c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10)

, e=d0+10 a=a0, b=b0, c=c0, d=d0

slide-22
SLIDE 22

Background: Dynamic Symbolic Execution

  • 01. foo(int a, int b, int c, int d) {
  • 02. if (c > a)
  • 03. int e=d+10
  • 04. if (b > 5)
  • 05. // do something
  • 06. else if (a < e)
  • 07. if (b < c)
  • 08. // do something
  • 09. else
  • 10. // do something
  • 11. else
  • 12. // do something
  • 13. return
  • 14. }

Inputs: a=4, b= 5, c=6, d=1 Executed branches: Symbolic state: Path condition (PC): DSE:

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10)

2T, 4F, 7T 6T,

Λ (b0 < c0) Λ (b0 >= c0) (c0 > a0) Λ (b0 <= 5) Λ (a0 >= d0 + 10) (c0 > b0) Λ (b0 > 5) (c0 <= b0) (c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10)

, e=d0+10 a=a0, b=b0, c=c0, d=d0

slide-23
SLIDE 23

Symbolic Execution

slide-24
SLIDE 24

Symbolic Execution

Program

slide-25
SLIDE 25

Symbolic Execution

Program Symbolic executor

slide-26
SLIDE 26

Symbolic Execution

Program Symbolic executor

slide-27
SLIDE 27

Symbolic Execution

Program Symbolic executor

slide-28
SLIDE 28

Symbolic Execution

Program Symbolic executor

slide-29
SLIDE 29

Symbolic Execution

Program Symbolic executor

PC c1 ∧ ... ∧ cn

slide-30
SLIDE 30

Symbolic Execution

Program Symbolic executor SMT solver

PC c1 ∧ ... ∧ cn PC c1 ∧ ... ∧ cn

slide-31
SLIDE 31

Symbolic Execution

Program Symbolic executor SMT solver

PC c1 ∧ ... ∧ cn PC c1 ∧ ... ∧ cn Sat/Unsat (solution)

slide-32
SLIDE 32

Symbolic Execution and SMT Solving

Symbolic executor SMT solver

PC c1 ∧ ... ∧ cn Sat/Unsat (solution)

slide-33
SLIDE 33

Symbolic Execution and SMT Solving

Symbolic executor SMT solver

PC c1 ∧ ... ∧ cn Sat/Unsat (solution)

slide-34
SLIDE 34

Symbolic Execution and SMT Solving

Symbolic executor SMT solver

PC c1 ∧ ... ∧ cn Sat/Unsat (solution)

slide-35
SLIDE 35

What Are We Missing?

  • Context information (e.g., existence
  • f previous solutions for similar PCs)
  • Domain knowledge (e.g., programs’

specific properties)

slide-36
SLIDE 36

State of the Art

  • Some techniques present initial solutions

(domain-based constraint optimizations)

  • But:
  • What is the effectiveness of these

techniques?

  • What other techniques could be used?
  • Would symbolic execution actually benefit

from these techniques?

slide-37
SLIDE 37

Our Goal

  • Initial investigation of these questions by
  • proposing a novel constraint optimization

technique for dynamic symbolic execution: DomainReduce

  • performing an empirical evaluation to

assess new and existing optimizations empirically

slide-38
SLIDE 38

DomainReduce:

Intuitive View

SMT solver

PC c1 ∧ ... ∧ cn Sat/Unsat (solution)

slide-39
SLIDE 39

DomainReduce:

Intuitive View

SMT solver

PC c1 ∧ ... ∧ cn Sat/Unsat (solution)

slide-40
SLIDE 40

DomainReduce:

Intuitive View

SMT solver

PC c1 ∧ ... ∧ cn Sat/Unsat (solution)

slide-41
SLIDE 41

DomainReduce:

Intuitive View

SMT solver

PC c1 ∧ ... ∧ cn Sat/Unsat (solution)

Restrict domain of constraints to be solved by leveraging solutions of similar PCs

slide-42
SLIDE 42

DomainReduce:

Intuitive View

SMT solver

PC c1 ∧ ... ∧ cn Sat/Unsat (solution)

Restrict domain of constraints to be solved by leveraging solutions of similar PCs

slide-43
SLIDE 43

DomainReduce:

Intuitive View

SMT solver

PC c1 ∧ ... ∧ cn Sat/Unsat (solution)

Restrict domain of constraints to be solved by leveraging solutions of similar PCs

slide-44
SLIDE 44

DomainReduce:

Intuitive View

SMT solver

PC c1 ∧ ... ∧ cn Sat/Unsat (solution)

Restrict domain of constraints to be solved by leveraging solutions of similar PCs

slide-45
SLIDE 45

DomainReduce:

Intuitive View

SMT solver

PC c1 ∧ ... ∧ cn Sat/Unsat (solution)

Restrict domain of constraints to be solved by leveraging solutions of similar PCs

slide-46
SLIDE 46

DomainReduce:

Intuitive View

SMT solver

PC c1 ∧ ... ∧ cn Sat/Unsat (solution)

Restrict domain of constraints to be solved by leveraging solutions of similar PCs

slide-47
SLIDE 47

DomainReduce:

Intuitive View

SMT solver

PC c1 ∧ ... ∧ cn Sat/Unsat (solution)

Trade-off speed/likelihood of finding solutions

Restrict domain of constraints to be solved by leveraging solutions of similar PCs

slide-48
SLIDE 48

DomainReduce Example

(with dependencies)

slide-49
SLIDE 49

DomainReduce Example

(with dependencies)

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 < c0)

slide-50
SLIDE 50

DomainReduce Example

(with dependencies)

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 < c0) a0 = 4, b0 = 5, c0 = 6, d0 = 1

{

slide-51
SLIDE 51

DomainReduce Example

(with dependencies)

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 < c0) a0 = 4, b0 = 5, c0 = 6, d0 = 1 (c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0)

{

slide-52
SLIDE 52

DomainReduce Example

(with dependencies)

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 < c0) a0 = 4, b0 = 5, c0 = 6, d0 = 1 (c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0)

{

With dependencies:

slide-53
SLIDE 53

DomainReduce Example

(with dependencies)

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 < c0) a0 = 4, b0 = 5, c0 = 6, d0 = 1 (c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0)

{

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0) With dependencies:

slide-54
SLIDE 54

DomainReduce Example

(with dependencies)

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 < c0) a0 = 4, b0 = 5, c0 = 6, d0 = 1 (c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0)

{

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0) With dependencies:

slide-55
SLIDE 55

DomainReduce Example

(with dependencies)

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 < c0) a0 = 4, b0 = 5, c0 = 6, d0 = 1 (c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0)

{

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0) With dependencies: (5 > 4) Λ (b0 <= 5) Λ (4 < 1 + 10) Λ (b0 >= 6)

slide-56
SLIDE 56

DomainReduce Example

(with dependencies)

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 < c0) a0 = 4, b0 = 5, c0 = 6, d0 = 1 (c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0)

{

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0) With dependencies: (5 > 4) Λ (b0 <= 5) Λ (4 < 1 + 10) Λ (b0 >= 6)

slide-57
SLIDE 57

DomainReduce Example

(with dependencies)

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 < c0) a0 = 4, b0 = 5, c0 = 6, d0 = 1 (c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0)

{

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0) With dependencies: (5 > 4) Λ (b0 <= 5) Λ (4 < 1 + 10) Λ (b0 >= 6) (c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0)✘

slide-58
SLIDE 58

DomainReduce Example

(with dependencies)

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 < c0) a0 = 4, b0 = 5, c0 = 6, d0 = 1 (c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0)

{

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0) With dependencies: (5 > 4) Λ (b0 <= 5) Λ (4 < 1 + 10) Λ (b0 >= 6) (c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0)✘

slide-59
SLIDE 59

DomainReduce Example

(with dependencies)

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 < c0) a0 = 4, b0 = 5, c0 = 6, d0 = 1 (c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0)

{

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0) With dependencies: (5 > 4) Λ (b0 <= 5) Λ (4 < 1 + 10) Λ (b0 >= 6) (c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0) (c0 > a0) Λ (5 <= 5) Λ (a0 < d0 + 10) Λ (5 >= c0)

slide-60
SLIDE 60

DomainReduce Example

(with dependencies)

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 < c0) a0 = 4, b0 = 5, c0 = 6, d0 = 1 (c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0)

{

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0) With dependencies: (5 > 4) Λ (b0 <= 5) Λ (4 < 1 + 10) Λ (b0 >= 6) (c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0) (c0 > a0) Λ (5 <= 5) Λ (a0 < d0 + 10) Λ (5 >= c0)

✘ ✔

slide-61
SLIDE 61

Without dependencies:

DomainReduce Example

(without dependencies)

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 < c0) a0 = 4, b0 = 5, c0 = 6, d0 = 1 (c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0)

{

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0) (5 > 4) Λ (b0 <= 5) Λ (4 < 1 + 10) Λ (b0 >= 6) (c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0)✘

slide-62
SLIDE 62

Without dependencies:

DomainReduce Example

(without dependencies)

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 < c0) a0 = 4, b0 = 5, c0 = 6, d0 = 1 (c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0)

{

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0) (5 > 4) Λ (b0 <= 5) Λ (4 < 1 + 10) Λ (b0 >= 6) (c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0) (c0 > 4) Λ (5 <= 5) Λ (4 < 1 + 10) Λ (5 >= c0)

slide-63
SLIDE 63

Without dependencies:

DomainReduce Example

(without dependencies)

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 < c0) a0 = 4, b0 = 5, c0 = 6, d0 = 1 (c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0)

{

(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0) (5 > 4) Λ (b0 <= 5) Λ (4 < 1 + 10) Λ (b0 >= 6) (c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 >= c0) (c0 > 4) Λ (5 <= 5) Λ (4 < 1 + 10) Λ (5 >= c0)

✘ ✔

slide-64
SLIDE 64

Terminology

  • Target constraint:

negated constraint

  • Target variables:

variables in negated constraint

  • Direct dependency (ca, cb):

vars(ca) ∩ vars(cb) ≠ 0

  • Indirect dependency (ca, cb):

vars(ca) ∩ vars(c1) ≠ 0, vars(c1) ∩ vars(c2) ≠ 0, ..., vars(cn) ∩ vars(cb) ≠ 0

slide-65
SLIDE 65

DomainReduce Algorithm

  • s = 1
  • until sat or s=max or time limit reached
  • select next subset TV of target variables of size s
  • if no more subsets, increase s and reiterate
  • identify variables dependents on TV and add them to TV
  • keep variables in TV symbolic
  • concretize all other variables
  • invoke solver
slide-66
SLIDE 66

Other Techniques Considered

  • Incremental solving (Sen et al, 2005)
  • Eliminates irrelevant constraints
  • Analogous to worst case for DomainReduce with

dependencies

  • Subsumption (Godefroid et al, 2008)
  • Eliminates implied constraints in input-bound loops
  • In hindsight, not really a constraint-optimization

approach

slide-67
SLIDE 67

Empirical Evaluation

Goal: Quantitative initial investigation of the usefulness of constraint optimization RQ1: Are constraint optimization techniques effective? RQ2: How do the different techniques compare to each other?

slide-68
SLIDE 68

Experimental Infrastructure

  • Tool

Customized JFuzz/JPF framework

  • Software subjects

HTMLParser XMLParser K-Nearest Neighbor

  • Solvers

CVC3, Z3

  • Data
  • Ten input sets per subject
  • Over 5,000 real path conditions; ∀ technique and constraint:

– Number of path conditions solved by the technique – Time necessary to solve the condition (10 minutes timeout)

slide-69
SLIDE 69

Experimental Infrastructure

  • Tool

Customized JFuzz/JPF framework

  • Software subjects

HTMLParser XMLParser K-Nearest Neighbor

  • Solvers

CVC3, Z3

  • Data
  • Ten input sets per subject
  • Over 5,000 real path conditions; ∀ technique and constraint:

– Number of path conditions solved by the technique – Time necessary to solve the condition (10 minutes timeout)

Infrastructure and data freely available online: http://www.cc.gatech.edu/~ikpeme/software/

slide-70
SLIDE 70

Study Results 1

(# constraints processed)

slide-71
SLIDE 71

Study Results 1

(# constraints processed)

  • Results for HTMLParser not compelling
slide-72
SLIDE 72

Study Results 1

(# constraints processed)

  • Results for HTMLParser not compelling
  • Optimizations ineffective for Z3
slide-73
SLIDE 73

Study Results 1

(# constraints processed)

  • Results for HTMLParser not compelling
  • Optimizations ineffective for Z3
  • Useless or ineffective, with one exception
slide-74
SLIDE 74

Study Results 1

(# constraints processed)

  • Results for HTMLParser not compelling
  • Optimizations ineffective for Z3
  • Useless or ineffective, with one exception
  • DomainReduce produces negative results for K-NN (worst case)
slide-75
SLIDE 75

Study Results 1

(# constraints processed)

  • Results for HTMLParser not compelling
  • Optimizations ineffective for Z3
  • Useless or ineffective, with one exception
  • DomainReduce produces negative results for K-NN (worst case)
  • Optimizations effective for CVC3
slide-76
SLIDE 76

Study Results 1

(# constraints processed)

  • Results for HTMLParser not compelling
  • Optimizations ineffective for Z3
  • Useless or ineffective, with one exception
  • DomainReduce produces negative results for K-NN (worst case)
  • Optimizations effective for CVC3
  • Small improvement for K-NN
slide-77
SLIDE 77

Study Results 1

(# constraints processed)

  • Results for HTMLParser not compelling
  • Optimizations ineffective for Z3
  • Useless or ineffective, with one exception
  • DomainReduce produces negative results for K-NN (worst case)
  • Optimizations effective for CVC3
  • Small improvement for K-NN
  • Dramatic improvement for XMLParser (25% ➡ 100%)
slide-78
SLIDE 78

Study Results 2

(time to process constraints)

slide-79
SLIDE 79

Study Results 2

(time to process constraints)

K-NN, CVC3

slide-80
SLIDE 80

Study Results 2

(time to process constraints)

K-NN, Z3 K-NN, CVC3

slide-81
SLIDE 81

Study Results 2

(time to process constraints)

K-NN, Z3 K-NN, CVC3

slide-82
SLIDE 82

Study Results 2

(time to process constraints)

slide-83
SLIDE 83

Study Results 2

(time to process constraints)

!

XMLParser, CVC3

slide-84
SLIDE 84

Study Results 2

(time to process constraints)

XMLParser, Z3

!

XMLParser, CVC3

slide-85
SLIDE 85

Study Results 2

(time to process constraints)

XMLParser, Z3

!

XMLParser, CVC3

Analogous results for HTML Parser

slide-86
SLIDE 86

Study Results 2

(time to process constraints)

slide-87
SLIDE 87

Study Results 2

(time to process constraints)

  • K-NN
  • All but one optimizations provided no benefits

(timeout or unsat after a long time)

  • DomainReduce with no dependencies finds solutions for

less constraints, but very quickly, for K-NN and CVC3

slide-88
SLIDE 88

Study Results 2

(time to process constraints)

  • K-NN
  • All but one optimizations provided no benefits

(timeout or unsat after a long time)

  • DomainReduce with no dependencies finds solutions for

less constraints, but very quickly, for K-NN and CVC3

  • HTMLParser and XMLParser
  • Almost all optimizations improve efficiency of constraint

solvers dramatically (several orders of magnitude)

slide-89
SLIDE 89
slide-90
SLIDE 90
slide-91
SLIDE 91

Future work

  • More experiments

(subjects, solvers, configurations)

  • Investigate why optimizations

work/don’t work

  • Apply optimizations in parallel
  • More sophisticated optimizations

(program structure or properties)

  • Tighter integration