95
EXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil Dillig and Calvin Lin UT Austin 1

EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Embed Size (px)

Citation preview

Page 1: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

EXPLORER : Query- and Demand-Driven Exploration

of Interprocedural Control Flow Properties

Yu Feng, Xinyu Wang, Isil Dillig and Calvin Lin

UT Austin

1

Page 2: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Motivation

2

Many problems require answers to queries about control flow properties

Page 3: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Motivation

2

Many problems require answers to queries about control flow properties

Can foo() transitively invoke bar()?

Page 4: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Motivation

2

Many problems require answers to queries about control flow properties

launch()

sendSMSexec

loadLibrary...

Security

Can foo() transitively invoke bar()?

Page 5: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Motivation

2

Many problems require answers to queries about control flow properties

Page 6: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Motivation

2

Many problems require answers to queries about control flow properties

Can foo() transitively invoke bar() without calling goo() in the middle?

Page 7: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Motivation

2

Many problems require answers to queries about control flow properties

onclick() !asynctask

IOAccess DB

Socket...Performance

bugs

Can foo() transitively invoke bar() without calling goo() in the middle?

Page 8: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Steps to answer control flow queries

3

Page 9: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Steps to answer control flow queries

3

Step 1: Build a calligraph

Page 10: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Steps to answer control flow queries

3

Step 1: Build a calligraph

Page 11: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Steps to answer control flow queries

3

Step 1: Build a calligraph

Step 2: Customize

analysis

Page 12: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Steps to answer control flow queries

3

Step 1: Build a calligraph

Step 2: Customize

analysis

Page 13: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Why is this suboptimal?

4

Page 14: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Why is this suboptimal?

User must figure out what callgraph to use

4

Page 15: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Why is this suboptimal?

User must figure out what callgraph to use

CHA and RTA are fast but imprecise

4

Page 16: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Why is this suboptimal?

User must figure out what callgraph to use

CHA and RTA are fast but imprecise

Using pointer analysis (kcfa, kobj) are precise but not scalable

4

Page 17: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Why is this suboptimal?

User must figure out what callgraph to use

CHA and RTA are fast but imprecise

Using pointer analysis (kcfa, kobj) are precise but not scalable

User must write different analyses for answering each kind of queries

4

Page 18: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Our insights

5

Page 19: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Our insights

General framework to answer many different kinds of queries

5

Page 20: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Our insights

General framework to answer many different kinds of queries

Users do not need to write custom analyses

5

Page 21: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Our insights

General framework to answer many different kinds of queries

Users do not need to write custom analyses

To give a precise answer for a query, don’t need callgraph that is precise everywhere

5

Page 22: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Our insights

General framework to answer many different kinds of queries

Users do not need to write custom analyses

To give a precise answer for a query, don’t need callgraph that is precise everywhere

Only need to focus on parts of callgraph that are relevant to the query

5

Page 23: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Contributions

6

Page 24: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Contributions

General query language for describing queries on control flow properties

6

Page 25: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Contributions

General query language for describing queries on control flow properties

Refinement-based algorithm for answering control flow queries

6

Page 26: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Contributions

General query language for describing queries on control flow properties

Refinement-based algorithm for answering control flow queries

Only refine parts of callgraph relevant to the query

6

Page 27: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Overview

7

Page 28: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Key idea 1

8

Page 29: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Key idea 1

8

Our query language: regular expression

Page 30: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Key idea 1

8

Our query language: regular expression

Examples written in our query language

Page 31: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Key idea 1

8

main foo

Our query language: regular expression

Examples written in our query language

Page 32: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Key idea 1

8

main foo

main .* foo

Our query language: regular expression

Examples written in our query language

Page 33: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Key idea 1

8

main foo

main .* foo

(.*(!foo)* bar)

Our query language: regular expression

Examples written in our query language

Page 34: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Key idea 2

Focus on graph that is relevant to the query

Page 35: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Key idea 2

foo .* bar

Focus on graph that is relevant to the query

Page 36: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Key idea 2

foo

bar

hoogoo

callgraph

foo .* bar

Focus on graph that is relevant to the query

Page 37: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Key idea 2

foo

bar

hoogoo

callgraph

foo .* bar

Focus on graph that is relevant to the query

Page 38: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Key idea 2

foo

bar

hoogoo

callgraph

foo

bar

goo

Relevant part!

foo .* bar

Focus on graph that is relevant to the query

Page 39: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Solution

10

Page 40: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Solution

10

Callgraph Automaton

Page 41: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Solution

10

Query Automaton

Callgraph Automaton

Page 42: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Solution

10

Query Automaton

Callgraph Automaton

ProductAutomaton

Page 43: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Solution

10

NOEmpty

Query Automaton

Callgraph Automaton

ProductAutomaton

Page 44: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Solution

10

NOEmpty

Query Automaton

Callgraph Automaton

ProductAutomaton

Refine callgraph by issuing pts-to query

Refinement

Point-toQuery

YES

Page 45: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Solution

10

NOEmpty

Query Automaton

Callgraph Automaton

ProductAutomaton

Page 46: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Solution

10

NOEmpty

Query Automaton

Callgraph Automaton

ProductAutomaton

EdgesRefinement

Point-toQuery

Min-CutNot

Empty

Minimize the number of queries

Page 47: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Solution

10

NOEmpty

Query Automaton

Callgraph Automaton

ProductAutomaton

EdgesRefinement

Point-toQuery

Min-CutNot

Empty

Minimize the number of queries

Page 48: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Solution

10

NOEmpty

Query Automaton

Callgraph Automaton

ProductAutomaton

EdgesRefinement

Point-toQuery

Min-CutNot

Empty

YES

Minimize the number of queries

Page 49: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Example

11

void main(...) { A x; A y; if (...) x = new A(); y = new B(); else x = new B(); y = new C(); x.foo();}

Page 50: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Example - Step 1

Query: Can A:foo transitively call C:bar?

12

Convert Query to Query Automaton

.* (A:foo) .*(C:bar)

Page 51: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Example - Step 1

Query: Can A:foo transitively call C:bar?

12

Convert Query to Query Automaton

1 2 3A:foo C:bar

. . ..* (A:foo) .*(C:bar)

Page 52: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Example - Step 2

main

A:foo

A:bar B:bar

B:foo

C:bar

A:woo

13

Convert callgraph to callgraph automaton

Page 53: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Example - Step 2

main

A:foo

A:bar B:bar

B:foo

C:bar

A:woo

13

Convert callgraph to callgraph automaton

q_m

q_af

q_bf

q_bb

q_ab

q_aw

q_cb

Entry main

B:foo

A:woo

B:bar

C:bar

C:bar

A:woo

A:bar

A:bar

B:bar

A:foo

Page 54: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Example - Step 3

14

Compute product automaton by intersecting query and callgraph automata

Entry,1 q_m,1 q_af,2 q_aw,2 q_cb,3

main A:foo A:woo C:bar

C:bar

q_bf,1 q_aw,1

B:foo

A:woo

q_ab,2 q_bb,2

A:barB:bar

Page 55: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Example - Step 3

14

Compute product automaton by intersecting query and callgraph automata

Entry,1 q_m,1 q_af,2 q_aw,2 q_cb,3

main A:foo A:woo C:bar

C:bar

q_bf,1 q_aw,1

B:foo

A:woo

q_ab,2 q_bb,2

A:barB:bar

Won’t scale if we construct it naively

Page 56: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Example - Step 3

14

Compute product automaton by intersecting query and callgraph automata

Entry,1 q_m,1 q_af,2 q_aw,2 q_cb,3

main A:foo A:woo C:bar

C:bar

q_bf,1 q_aw,1

B:foo

A:woo

q_ab,2 q_bb,2

A:barB:bar

Won’t scale if we construct it naively

Page 57: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Example - Step 3

14

Entry,1

q_m,1 q_af,2 q_aw,2 q_cb,3

main

A:foo A:woo C:bar

C:bar

Compute product automaton by intersecting query and callgraph automata

Page 58: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

How to refine effectively

15

Page 59: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

How to refine effectively

If intersection is non-empty: callgraph may have spurious edges and we need to refine

15

Page 60: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

How to refine effectively

If intersection is non-empty: callgraph may have spurious edges and we need to refine

Performing min-cut on product automaton to minimize # points-to queries

15

Page 61: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

How to refine effectively

If intersection is non-empty: callgraph may have spurious edges and we need to refine

Performing min-cut on product automaton to minimize # points-to queries

15

Weight on the edges are either 1 or infinite.

Page 62: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Example - Step 4

16

void main(...) { A x; A y; if (...) x = new A(); y = new B(); else x = new B(); y = new C(); x.foo();}

Entry,1 q_m,1 q_af,2 q_aw,2 q_cb,3A:foo A:woo C:bar

C:bar

main

Refine Product automaton via min-cut and demand-driven pointer analysis

Page 63: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Example - Step 4

16

void main(...) { A x; A y; if (...) x = new A(); y = new B(); else x = new B(); y = new C(); x.foo();}

Entry,1 q_m,1 q_af,2 q_aw,2 q_cb,3A:foo A:woo C:bar

C:bar

main

Refine Product automaton via min-cut and demand-driven pointer analysis

Page 64: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Example - Step 4

16

void main(...) { A x; A y; if (...) x = new A(); y = new B(); else x = new B(); y = new C(); x.foo();}

Entry,1 q_m,1 q_af,2 q_aw,2 q_cb,3A:foo A:woo C:bar

C:bar

main

Refine Product automaton via min-cut and demand-driven pointer analysis

Page 65: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Example - Step 4

16

void main(...) { A x; A y; if (...) x = new A(); y = new B(); else x = new B(); y = new C(); x.foo();}

Entry,1 q_m,1 q_af,2 q_aw,2 q_cb,3A:foo A:woo C:bar

C:bar

main

Refine Product automaton via min-cut and demand-driven pointer analysis

Page 66: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Example - Step 4

16

void main(...) { A x; A y; if (...) x = new A(); y = new B(); else x = new B(); y = new C(); x.foo();}

Entry,1 q_m,1 q_af,2 q_aw,2 q_cb,3A:foo A:woo C:barmain

Refine Product automaton via min-cut and demand-driven pointer analysis

Page 67: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Example - Step 4

16

void main(...) { A x; A y; if (...) x = new A(); y = new B(); else x = new B(); y = new C(); x.foo();}

Entry,1 q_m,1 q_af,2 q_aw,2 q_cb,3A:foo A:woomain

Refine Product automaton via min-cut and demand-driven pointer analysis

Page 68: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Example - Step 4

16

void main(...) { A x; A y; if (...) x = new A(); y = new B(); else x = new B(); y = new C(); x.foo();}

Entry,1 q_m,1 q_af,2 q_aw,2 q_cb,3A:foo A:woomain

Refine Product automaton via min-cut and demand-driven pointer analysis

Page 69: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Example - Step 4

Answer: NO!

16

void main(...) { A x; A y; if (...) x = new A(); y = new B(); else x = new B(); y = new C(); x.foo();}

Entry,1 q_m,1 q_af,2 q_aw,2 q_cb,3A:foo A:woomain

Refine Product automaton via min-cut and demand-driven pointer analysis

Page 70: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Evaluation

17

Page 71: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Evaluation

Analysis of the observer design pattern in Java programs

17

Page 72: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Evaluation

Analysis of the observer design pattern in Java programs

Identification of performance bugs caused by GUI lagging in Android applications

17

Page 73: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Evaluation

Analysis of the observer design pattern in Java programs

Identification of performance bugs caused by GUI lagging in Android applications

Analysis of inter-component communication in Android

17

Page 74: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Evaluation

Analysis of the observer design pattern in Java programs

Identification of performance bugs caused by GUI lagging in Android applications

Analysis of inter-component communication in Android

17

Page 75: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Evaluation

Analysis of the observer design pattern in Java programs

Identification of performance bugs caused by GUI lagging in Android applications

Analysis of inter-component communication in Android

17

Page 76: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Evaluation

Analysis of the observer design pattern in Java programs

Identification of performance bugs caused by GUI lagging in Android applications

Analysis of inter-component communication in Android

17

Page 77: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Evaluation

classMainActivity{onClick(){Cursorc=sqLiteDatabase.query(...);}}

classMainActivity{onClick(){newLongOperation().execute("");

}}

classLongOperationextendsAsyncTask{doInBackground(...){

Cursorc=sqLiteDatabase.query(...);

}

18

Page 78: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Evaluation

classMainActivity{onClick(){Cursorc=sqLiteDatabase.query(...);}}

classMainActivity{onClick(){newLongOperation().execute("");

}}

classLongOperationextendsAsyncTask{doInBackground(...){

Cursorc=sqLiteDatabase.query(...);

}

18

Page 79: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Evaluation

classMainActivity{onClick(){Cursorc=sqLiteDatabase.query(...);}}

classMainActivity{onClick(){newLongOperation().execute("");

}}

classLongOperationextendsAsyncTask{doInBackground(...){

Cursorc=sqLiteDatabase.query(...);

}

18

Page 80: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Evaluation

classMainActivity{onClick(){Cursorc=sqLiteDatabase.query(...);}}

classMainActivity{onClick(){newLongOperation().execute("");

}}

classLongOperationextendsAsyncTask{doInBackground(...){

Cursorc=sqLiteDatabase.query(...);

}

18

.* onClick (!doInBackground)* query

Page 81: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Evaluation

19

Running time for detecting performance bugs(Lower is better)[Liu et al. ICSE’ 2014]

Page 82: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Evaluation

19

Valu

e Ti

tle

0

1000

2000

3000

4000

Ushahidi c:geo Geohash FireFox APG BitcoinWallet MyTrack

CHA KOBJ EXPLORER

Running time for detecting performance bugs(Lower is better)[Liu et al. ICSE’ 2014]

Page 83: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Evaluation

19

Valu

e Ti

tle

0

1000

2000

3000

4000

Ushahidi c:geo Geohash FireFox APG BitcoinWallet MyTrack

CHA KOBJ EXPLORER

Running time for detecting performance bugs(Lower is better)[Liu et al. ICSE’ 2014]

Page 84: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Evaluation

19

Valu

e Ti

tle

0

1000

2000

3000

4000

Ushahidi c:geo Geohash FireFox APG BitcoinWallet MyTrack

CHA KOBJ EXPLORER

Running time for detecting performance bugs(Lower is better)

T/O

[Liu et al. ICSE’ 2014]

Page 85: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Evaluation

19

Valu

e Ti

tle

0

1000

2000

3000

4000

Ushahidi c:geo Geohash FireFox APG BitcoinWallet MyTrack

CHA KOBJ EXPLORER

Running time for detecting performance bugs(Lower is better)

T/O

[Liu et al. ICSE’ 2014]

Page 86: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Evaluation

20

Number of warnings (Lower is better)

Page 87: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Evaluation

20

0

100

200

300

400

Ushahidi c:geo Geohash FireFox APG BitcoinWallet MyTrack

CHA KOBJ EXPLORER

Number of warnings (Lower is better)

Page 88: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Evaluation

20

0

100

200

300

400

Ushahidi c:geo Geohash FireFox APG BitcoinWallet MyTrack

CHA KOBJ EXPLORER

Number of warnings (Lower is better)

Page 89: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Evaluation

20

0

100

200

300

400

Ushahidi c:geo Geohash FireFox APG BitcoinWallet MyTrack

CHA KOBJ EXPLORER

Number of warnings (Lower is better)

N/A

Page 90: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Evaluation

20

0

100

200

300

400

Ushahidi c:geo Geohash FireFox APG BitcoinWallet MyTrack

CHA KOBJ EXPLORER

Number of warnings (Lower is better)

N/A

Page 91: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Conclusion

EXPLORER is …

21

http://fredfeng.github.io/explorer/

Page 92: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Conclusion

EXPLORER is …

21

Query Driven

http://fredfeng.github.io/explorer/

Page 93: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Conclusion

EXPLORER is …

21

Query Driven Demand Driven

http://fredfeng.github.io/explorer/

Page 94: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Conclusion

EXPLORER is …

21

Query Driven Demand Driven

http://fredfeng.github.io/explorer/

Practical

Page 95: EXPLORER : Query- and Demand-Driven Exploration of ... · PDF fileEXPLORER : Query- and Demand-Driven Exploration of Interprocedural Control Flow Properties Yu Feng, Xinyu Wang, Isil

Thank you!

Sridharan et al. "Refinement-based context-sensitive points-to analysis for Java.” PLDI’ 06.

Liu et al. "Characterizing and detecting performance bugs for smartphone applications." ICSE’ 2014.

Christensen et al. Precise analysis of string expressions. SAS’ 2003.

22