Su Ping and Ma Xiao-xing Department of Computer Science and Technology Nanjing University Automated...

Post on 11-Jan-2016

212 views 0 download

Tags:

transcript

Su Ping and Ma Xiao-xingDepartment of Computer Science and Technology

Nanjing University

Automated Analysis of Dynamic Dependences

between Java Components

MotivationApproach to dynamic dependencesDDETEvaluationSummaryFuture work

Nanjing University © Su Ping 2

Agenda

Dynamic updates in safe and low-disruptive way

Criteria for dynamic updates

Quiescence Tranquillity Version-consistency

Nanjing University © Su Ping 3

Motivation

• Static dependences Quiescence• Dynamic dependences

Tranquillity、Version-consistency

Nanjing University © Su Ping 4

Dependences Considered

Safe!L0

L1

L2Safe!

Unsafe!

The more precise dynamic dependences are, the timelier dynamic updates can start!

Static dependences pessimistically include all potential constraints, bringing high disruption[1]!

Goal Get precise dynamic dependences at any point

when the program runs

Scope Java Bytecode Component-based System

Nanjing University © Su Ping 5

Our Work

Dynamic dependencesFuture set: depended components it might use in

the future

Past set: depended components it has used in the past

Dynamic dependences

Portal

T0

Auth Proc DB

T1

getToken(cred)

return token

T2

process(token, data)

T3

verify(token)

OK

T4

dbOp()

6

{Auth,Proc}

{}{Auth}{Proc}

{}{Auth,Proc

}

Start

End

All participants in a transaction are initiator of the transaction or directly connected to the initiator [2].

Dynamic dependences changing makes the running

transaction like an automaton.

Nanjing University © Su Ping 7

Overview

JavaClassFiles

ControlFlow

Graph

Dynamic Dependences

Automaton

TransformedJavaClassFiles

Trigger information have been inserted into the Java class files so that they can drive the automaton to run automatically!

Dynamic Dependences

output

derivation

instrumentation

State: dynamic dependences Future Past

EventActionTransition

Nanjing University © Su Ping 8

Dynamic Dependences Automaton

1

e1(Ejb.a.5)

2

7

3 6

4

5

e3(Ejb.a.34)

e7(If.1.11)

e4(Ejb.b.41)

e5(Ejb.b.47)

e6(if.0.11)

e9(While.F.29)

e8(While.T.29)e2(Ejb.c.23)

End

e10(End.50)

a;b;cnull

a;b;ca

a;b;c? a

? a;c

a;b? a

? a;ca;b;c? a

? a;c

ba

b? a

? a;c? a;b

null? a

? a;c? a;b

0

e0(Start.1)

statei statej

event

action

Control flow graph (CFG) All possible paths Next bytecode knows easily

Tools: ASM, Soot, Java Path Finder(JPF)

DDA derivation DFS CFG

Merge states with the same contents

Nanjing University © Su Ping 9

DDA Derivation

Nanjing University © Su Ping 10

Example

Source Code Byte Code

B

A

C

Tran

Event: change dynamic dependences potentiallyStartUse service from other componentsBranchEnd

Nanjing University © Su Ping 11

Event

Nanjing University © Su Ping 12

Example: CFG0

1

2

4

3

5

76

8

9

CFG Byte Code

Nanjing University © Su Ping 13

DDA derivation0

1

2

4

3

5

76

8

9

1

e1(Ejb.a.5)

2

7

3 6

4

5

e3(Ejb.a.34)

e7(If.1.11)

e4(Ejb.b.41)

e5(Ejb.b.47)

e6(if.0.11)

e9(While.F.29)

e8(While.T.29)e2(Ejb.c.23)

End

e10(End.50)

0

e0(Start.1)

There is no event, so dynamic dependences won’t change ! Merge the two states into one!

When meets an event, it will produce a new state and the triggered transition! Meanwhile, it transforms to the new state!

CFGDDA

DDA Derivation

Future set Depended components it might use in all

possible paths from current to ends

Past set Depended components it has used in its

executed path from start to current

Nanjing University © Su Ping 14

Approach to Dynamic Dependences

Analyze future of all states in DDA statically For each state

Depended components it might use in all possible paths from current state to end states

For each transition pre_future = pre_future post_future

component of event

Nanjing University © Su Ping 15

Future Computation

Nanjing University © Su Ping 16

Example: future computation

1

e1(Ejb.a.5)

2

7

3 6

4

5

e3(Ejb.a.34)

e7(If.1.11)

e4(Ejb.b.41)

e5(Ejb.b.47)

e6(if.0.11)

e9(While.F.29)

e8(While.T.29)e2(Ejb.c.23)

End

e10(End.50)

null

null

null

null null

null

null

null

0

e0(Start.1)

b

a;b

a;b

a;b;c

a;b;c

a;b

a;b;c

b

Future set of all states is null initially!

Change dependences adaptively

Past Only one executed path from start state to

current state cur_past = cur_past component of the event

Future Search DDA, find next state according to

current state and the event

Nanjing University © Su Ping 17

Adaptive-DDA

Nanjing University © Su Ping 18

A-DDA

1

e1(Ejb.a.5)

2

7

3 6

4

5

e3(Ejb.a.34)

e7(If.1.11)

e4(Ejb.b.41)

e5(Ejb.b.47)

e6(if.0.11)

e9(While.F.29)

e8(While.T.29)e2(Ejb.c.23)

End

e10(End.50)

a;b;cnull

a;b;c

a;b;c

a;b

a;b;c

b

b

null

0

e0(Start.1)

A-DDA Precise dynamic

dependences got adaptively

Example Path:e0e1e6e8e9e3e5e1

0

a

a

a

a;c

a;c

a;c

a;b;c

Past set of all states is null initially!

ASM

DDA is inserted in the annotation State

Transition

Trigger information is inserted Event

Nanjing University © Su Ping 19

Instrumentation

Nanjing University © Su Ping 20

Example: Instrumentation

Primary file Transformed file

DDA is inserted in the @transaction annotation.

Trigger information are inserted!

DDET framework

Nanjing University © Su Ping 21

DDET

DDA Derivation

Dynamic dependences

Instrumentation

Goal: to evaluate safety and disruption Compare our approach with the naïve

approach

Method: ask whether the component can be updated discretely

Safety: whether a updatable point is safe in fact

Disruption: number of updatable points

Nanjing University © Su Ping 22

Summary

Including all possible components, future set doesn’t change; Past set is changing.

Nanjing University © Su Ping 23

Results

Safe criteria for dynamic updates

Naïve approach Our approach

Yes No Yes No

Safe Un-safe

Safe Un-safe

Safe Un-safe

Safe Un-safe

Quiescence 2 18 2 18

Tranquillity 4 0 8 8 16 0 0 4

Version-consistency

4 0 8 8 16 0 0 8

Updatable point checked by safe criteriaNonupdatable point checked by safe criteria

Unsafe ,can not update!Safe in fact!

Safety: All updatable points are safe in fact!

Disruption: Compared to naïve approach, the number of updatable points using our approach is much larger!

Proposed an approach to get precise dynamic dependences automatically

Developed a dynamic dependences extracting tool——DDET using the approach

Experiments with DDET demonstrated our approach not only can ensure consistency, but also speed up the update.

Nanjing University © Su Ping 24

Conclusions

More precise future set Program slicing

Symbolic execution

Nanjing University © Su Ping 25

Future work

Thank you

Q&A

26