Techniques for Evolution-Aware Runtime Verification
Owolabi Legunsen, Yi Zhang, Milica Hadži-Tanović, Grigore Roșu, Darko Marinov ICST 2019 4/26/2019
CCF-1421503, CCF-1421575, CCF-1763788, CNS-1619275, CNS-1646305, CNS-1740916
Techniques for Evolution-Aware Runtime Verification Owolabi - - PowerPoint PPT Presentation
Techniques for Evolution-Aware Runtime Verification Owolabi Legunsen, Yi Zhang, Milica Hadi-Tanovi, Grigore Rou, Darko Marinov ICST 2019 4/26/2019 CCF-1421503, CCF-1421575, CCF-1763788, CNS-1619275, CNS-1646305, CNS-1740916 Runtime
Owolabi Legunsen, Yi Zhang, Milica Hadži-Tanović, Grigore Roșu, Darko Marinov ICST 2019 4/26/2019
CCF-1421503, CCF-1421575, CCF-1763788, CNS-1619275, CNS-1646305, CNS-1740916
whose violations can help find bugs
programming, typestate checking, etc.
2
Code + Tests
Violations Properties
3
4
… 65: im = Collections.synchronizedList(…); 66: for (IInvokedMethod iim : im) { … } … SuiteHTMLReporter TestOnClassListener
CSC was violated on… SuiteHTMLReporter.java:66… a synchronized collecon was accessed in thread−unsafe manner Violations
… CSC
Manual inspection: multiple threads can access “im”
5
Developers Version Control
Commit Changes 1 2 5 Fetch Changes 6 Release/Deploy
Builds per day:
projects: up to 80 Releases per day
6
CI Server
Pass/Fail
* Android only; Facebook: https://bit.ly/2CAPvN9 ; Google: https://bit.ly/2SYY4rR ; HERE: https://oreil.ly/2T0EyeK ; Microsoft: https://bit.ly/2HgjUpw ; Etsy: https://bit.ly/2IiSOJP ;
RV techniques are evolution-unaware (Base RV)
incur entire overhead if re-run after each code change
Developers Version Control
Commit Changes 1 2 5 6 Release/Deploy
7
CI Server
Pass/Fail
Code changes are typically very small relative to entire code base
Fetch Changes
0.97% of classes changed on average in our experiments
8
9
Code + Tests Instrumentation Instrumented Code + Tests Execution Monitors Events Violations Properties
CSC Collections.synchronizedList() Collection+.iterator()
10
The three techniques can be used together
11
Code + Tests Instrumentation Instrumented Code + Tests Execution Monitors Events Violations Properties Code + Tests
Suppression (VMS)
12
13
A TC TE Code Tests P2 P1 CSC Properties
Old Version: monitor CSC, P1, P2 New Version: re-monitor CSC, P1, P2 B C D E B Δ = {B}
Selected subset of properties are those that may generate new violations
14
Old version of Code+Tests All available properties Subset of all available properties New version of Code+Tests
15
A TC B D E TE C B
Re-monitors only properties that can be violated in parts of code affected by changes
Inheritance or Use
P2 P1
May Generate events for
CSC Step 1a: Build Class Dependency Graph (CDG) for new version Step 1b: Map classes to properties for which the classes may generate events Δ = {B}
16
A TC B D E TE C B
Re-monitors only properties that can be violated in parts of code affected by changes
Inheritance or Use
P2 P1
May Generate events for
CSC
Affected classes: those that generate events that can lead to new violations after code changes Step 2: Compute affected classes Class X is affected if
pass data to X
C TC D A Δ = {B}
17
A TC B D E TE C B
Re-monitors only properties that can be violated in parts of code affected by changes
Inheritance or Use
P2 P1
May Generate events for
CSC C TC D
Step 3: Select affected properties – those for which affected classes may generate events Step 4: Re-monitor affected properties: {CSC, P1}
A Δ = {B}
18
Step 2: Compute affected classes Step 3: Select affected properties Step 4: Re-monitor only affected properties Step 1a: Build Class Dependency Graph (CDG) for new version Step 1b: Map classes to properties for which they may generate events
Analysis Re-monitoring Base RV (Re-monitor all properties) Analysis Re-monitoring Time Savings Total Time for RPS Static and Fast 4.3% of RPS time
19
20
How can we improve these results?
Goal: Reduce RV overhead by varying “what” set of affected classes is used to select properties A TC B D E TE C B
Inheritance or Use
P2 P1
May Generate events for
CSC C TC D A
What classes are used to select properties? ps1 Changed classes (i.e., Δ) Dependents of Δ Dependees of Δ Dependees of Δ’s Dependents ps2 ps3
Δ = {B}
21
A TC B D E TE C B
Inheritance or Use
P2 P1
May Generate events for
CSC C TC D A
class D { static void foo(boolean b) { if (b) { // P1 events} else { // No P1 events} }} class C { void getF() { D.foo(B.b); }} class B {
+ public static boolean b = true; }
Δ = {B}
22
ps2 can be safe if C does not pass data to D
Goal: Reduce RV overhead by varying “where” selected properties are instrumented A TC B D E TE C B
Inheritance or Use
P2 P1
May Generate events for
CSC C TC D A
Where selected properties are instrumented (i ∈ {1,2,3}) psi affected(Δ) affected(Δ)c third-party libraries ps
ps
ps
Δ = {B}
23
24
“more efficient than” “less safe than”
2 Strong RPS variants are safe under certain assumptions: and
25
Base RV RPS Variants
26
Base RV RPS Variants
27
any event from the code
28
Combining RPS+RPP reduced RV overhead to 1.8x (from 9.4x)
29
All properties M N M+1 N - 1 V1 V2 V3 Critical phase Background phase
during software evolution
30
Owolabi Legunsen: legunse2@illinois.edu Yi Zhang: yzhng173@illinois.edu Milica Hadži-Tanović: milicah2@illinois.edu Grigore Roșu: grosu@illinois.edu Darko Marinov: marinov@illinois.edu