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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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
Symbolic Execution
SLIDE 24 Symbolic Execution
Program
SLIDE 25 Symbolic Execution
Program Symbolic executor
SLIDE 26 Symbolic Execution
Program Symbolic executor
SLIDE 27 Symbolic Execution
Program Symbolic executor
SLIDE 28 Symbolic Execution
Program Symbolic executor
SLIDE 29 Symbolic Execution
Program Symbolic executor
PC c1 ∧ ... ∧ cn
SLIDE 30 Symbolic Execution
Program Symbolic executor SMT solver
PC c1 ∧ ... ∧ cn PC c1 ∧ ... ∧ cn
SLIDE 31 Symbolic Execution
Program Symbolic executor SMT solver
PC c1 ∧ ... ∧ cn PC c1 ∧ ... ∧ cn Sat/Unsat (solution)
SLIDE 32 Symbolic Execution and SMT Solving
Symbolic executor SMT solver
PC c1 ∧ ... ∧ cn Sat/Unsat (solution)
SLIDE 33 Symbolic Execution and SMT Solving
Symbolic executor SMT solver
PC c1 ∧ ... ∧ cn Sat/Unsat (solution)
SLIDE 34 Symbolic Execution and SMT Solving
Symbolic executor SMT solver
PC c1 ∧ ... ∧ cn Sat/Unsat (solution)
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 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 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 DomainReduce:
Intuitive View
SMT solver
PC c1 ∧ ... ∧ cn Sat/Unsat (solution)
SLIDE 39 DomainReduce:
Intuitive View
SMT solver
PC c1 ∧ ... ∧ cn Sat/Unsat (solution)
SLIDE 40 DomainReduce:
Intuitive View
SMT solver
PC c1 ∧ ... ∧ cn Sat/Unsat (solution)
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 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 ✔
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 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 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 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 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
DomainReduce Example
(with dependencies)
SLIDE 49
DomainReduce Example
(with dependencies)
(c0 > a0) Λ (b0 <= 5) Λ (a0 < d0 + 10) Λ (b0 < c0)
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
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
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
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
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
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
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
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
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
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
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
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
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
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 Terminology
negated constraint
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 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 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
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 Experimental Infrastructure
Customized JFuzz/JPF framework
HTMLParser XMLParser K-Nearest Neighbor
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 Experimental Infrastructure
Customized JFuzz/JPF framework
HTMLParser XMLParser K-Nearest Neighbor
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
Study Results 1
(# constraints processed)
SLIDE 71 Study Results 1
(# constraints processed)
- Results for HTMLParser not compelling
SLIDE 72 Study Results 1
(# constraints processed)
- Results for HTMLParser not compelling
- Optimizations ineffective for Z3
SLIDE 73 Study Results 1
(# constraints processed)
- Results for HTMLParser not compelling
- Optimizations ineffective for Z3
- Useless or ineffective, with one exception
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 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 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 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
Study Results 2
(time to process constraints)
SLIDE 79 Study Results 2
(time to process constraints)
K-NN, CVC3
SLIDE 80 Study Results 2
(time to process constraints)
K-NN, Z3 K-NN, CVC3
SLIDE 81 Study Results 2
(time to process constraints)
K-NN, Z3 K-NN, CVC3
SLIDE 82
Study Results 2
(time to process constraints)
SLIDE 83 Study Results 2
(time to process constraints)
!
XMLParser, CVC3
SLIDE 84 Study Results 2
(time to process constraints)
XMLParser, Z3
!
XMLParser, CVC3
SLIDE 85 Study Results 2
(time to process constraints)
XMLParser, Z3
!
XMLParser, CVC3
Analogous results for HTML Parser
SLIDE 86
Study Results 2
(time to process constraints)
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 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 90
SLIDE 91 Future work
(subjects, solvers, configurations)
- Investigate why optimizations
work/don’t work
- Apply optimizations in parallel
- More sophisticated optimizations
(program structure or properties)